Client Side API
The functions are available on the client side in JavaScript to allow extending the default behaviour of Altis Accelerate beyond recording page views.
Setup Functions
Altis.Analytics.onReady( callback <function> )
Use this function to ensure analytics has loaded before making calls to Altis.Analytics.registerAttribute()
or Altis.Analytics.record()
for example.
Tracking Functions
Altis.Analytics.record( eventType <string> [, data <object>] )
Records an event of eventType
. This can be any string. The optional data passed in should be an object with either or both an attributes
object and metrics
object:
{
attributes: {
name: 'value' // <string>
// ...
},
metrics: {
name: 1 // <number>
// ...
},
}
Those attributes and metrics can be later used in custom queries.
Endpoint Functions
In Altis Accelerate an “Endpoint” refers to a visitor’s browser or device they are using to access your website.
Altis.Analytics.updateEndpoint( data <object> )
Updates the data associated with the current Endpoint. You can use this to provide updated custom user attributes and metrics, a user ID to connect multiple Endpoints, and demographic data. This data is used to define Audiences. Some data is collected and updated automatically:- UTM parameters,
utm_campaign
,utm_source
,utm_content
,utm_medium
,utm_term
- Operating System
- Device Brand e.g. Apple
- Browser
- Location, Country and Region
- Number of page views
- Number of sessions
{ "Attributes": { "key": string[], ... }, "Metrics": { "key": number, ... }, "User": { "UserAttributes": { "key": string[], ... }, "UserId": string } }
- UTM parameters,
Altis.Analytics.getEndpoint()
Returns the current Endpoint data object. Note that even if attributes, metrics or user attributes are provided as a single string or number they will be returned as an array of that type by this function.