The functions are available on the client side in JavaScript to allow extending the default behaviour of Altis Accelerate beyond recording page views.
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.
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.
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_campaign
, utm_source
, utm_content
, utm_medium
, utm_term
The data is merged with all new event records associated with that Endpoint.
The accepted data shape is as follows:
{
"Attributes": { "key": string[], ... },
"Metrics": { "key": number, ... },
"User": {
"UserAttributes": { "key": string[], ... },
"UserId": string
}
}
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.