Javascript Configuration
Initialization#
Both in npm and standalone mode, EventNative accepts the following parameters.
Parameter | Value |
---|---|
key * | Required. API key (How to get API key) |
tracking_host | If not set, EventNative will do the best attempt to detect it automatically |
cookie_name | Name of tracking cookie (__eventn_id by default) |
ga_hook | If set to true, EventNative will automatically listen to Google Analytics events and collect them. |
segment_hook | If set to true, EventNative will automatically listen to Segment's analytics.js event and collect them. |
randomize_url | If set to true, EventNative will send events on a dynamic endpoint. It allows avoiding ad blockers. |
All parameters with documentation can be in the interface definition file. This file is also bundled with npm package.
Tracking#
If EventNative is not configured to listen to Google Analytics or Segment events, you need to track these events manually. Unlike other analytics providers, EventNative is schema-less by design. You can send any parameters you wish without having to reconfigure the backend.
id()
sets the properties of the user (such as name
, e-mail
, internal id
β any parameters are accepted)
eventN.id({
"name": "Man with No Name",
"email": "thegoods@western.com",
"id": "6"
})
By default, a user_identification
event will be sent. However, it can be changed by setting the second parameter to true
.
eventN.id({...}, true);
eventN.track()
is used to record any event happens with user
eventN.track('{event_name}', {...event data})
If id()
has been called prior to track()
, all user details will be included.
Also, do not include parameters such as page URL and user agent. EventNative collects this automatically!
Read more about our event scheme.