Javascript Reference

Initialization

Both in npm and standalone mode, EventNative accepts the following parameters.

Parameter

Value

key *

Required. API key (see Configuration Manual)

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": "[email protected]",
"internal_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);

.track() is used to record any event happens with user

Syntax
Example
Syntax
eventN.track('{event_name}', {...event data})
Example
eventN.track('product_page_view', {
product_id: '1e48fb70-ef12-4ea9-ab10-fd0b910c49ce',
product_price: 399,
price_currency: 'USD'
});

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 here.