User profile and behaviour tracking

Tagging relevant information regarding your user profiles and their behaviours is crucial to send personalized and valuable messages.

Although the Accengage SDK collects by default certain useful information (such as first opt-in date, last visit date, number of visits, browser type…), it also offers a number of advanced tagging and tracking features for developers, that will allow you to target notifications, trigger messages at the right time and analyze your campaign performance.

It is important that you check with the product or marketing team what type of actions they would like to perform, so that you can determine which information needs to be tagged. Most of the time they will provide you with a ‘tagging plan’ which lists all of these. However, a strategy could be to first implement a minimal version of Web Push Notifications in order to speed up the process and learn faster, then implement the tagging plan at a later stage for more relevant messages.

Note that the Accengage Web SDK is compatible with Tag Management Systems, and Section 5 (Tag Management Systems) explains how to proceed.

In the following section, we will look at the various options that you can enjoy to collect and use the right information:

  • enrich user profile, thanks to custom device information (or User Attributes), which can be used for targeting and message personalization
  • tag user location, for geolocation targeting
  • tag user behaviours thanks to events, which offer many benefits (targeting, and measurement).

User Attributes

Enrich User profile with custom device information (or User Attributes)

In order to send well-targeted and personalized messages, Accengage lets you enrich your user profiles with additional relevant information, called custom device information (or User Attributes).

These are important for campaign targeting, as well as message personalization. 

For instance, if you tag and update the first name of a user, you will be able to personalize a message with “Hello ${firstname}”.

By implementing the library in your site, you will automatically gather certain information about your web visitors: their browser type, browser version, language, country code, time zone, domain where the user became opt-in first, first opt-in date, the number of visits and more.  The Accengage library lets you also collect additional custom device information, which can be attached to the user profile through custom database fields.

Traditional usage of custom device information for instance include first name, account ID (to match with external systems), total number of purchases, last purchased product, last purchase date, favorite product… They can be numeric values (set values, or incremental), strings, dates…

Make sure that your custom_field is already created in the database (targeting > database scheme > add a field). Otherwise, the data will be ignored! Check our user guide to have an overview of the database associated to your app and how to create a new field.

In order to enrich the user profile with additional user attributes (previously created in the database), you can use the core:updateDeviceInfo command:


Use this command to update the current user's information. Some fields, that we use internally, are filtered.

Argument Required Type Description
options yes <object> a list of fields <string> with value <string|number>
callbacks optional <object>
  • "onSuccess" : <void> 
  • "onError" : <string> label error

For instance

        "field1": "value1",
        "field2": "value2"

Update date-type data:

To update date-type fields, please format your date object in yyyy-MM-dd HH:mm:ss zzz string. The library provides a helper.

Update counter-type data: 

To update counter-type data, you can increment (or decrement) your field by prefixing the value with the positive sign + (or negative -).

User geolocation

It is possible to know the user location and to target users based on their last known position.

If you wish to target users based on their previous known location, you may use the following solutions below:

  • Requesting the native browser permission for user location (this permission needs to be given by the end user, each time you would like to know their location)
  • Pass the user location, and present date as the following user attributes (see above how to pass user attributes):


  lat: <Number>, // 48.870083
  long:<Number>, // 2.334254
  timestamp: <Number>

Behaviour tracking with events

Events are very useful to track user behaviors. One user may have multiple events, and all event occurrences are reported to the Accengage servers.

They can be used for:

  • Message targeting (subject to your site being integrated in the new Accengage platform)
  • Site or campaign performance measurment.

The library offers specific and useful methods to track standardized events such as ‘add to cart’ events,  ‘purchases’ or ‘leads’. You can also track custom events for other user behaviors.

For instance, with events, you could target users who have made 3 purchases over the last 30 days and who have visited more than 10 pages.

You will need to ask Accengage teams to activate events, and then you will be autonomous to create them in the Accengage dashboard (in settings > settings > add an event), so as to select them as targeting criteria.

Events are composed of a type (a numeric value which categorizes the type of event – see below), and parameters, which bring more information and can be targeted on (provided you are on the new platform).

To track events, you will need to interact with the Track plugin of the Web SDK.

Each command related to the Track Plugin uses an option <object> and callbacks <object> (containing <function>).

For instance

var options   = {
    "id": 1001
var callbacks = {
    "onSuccess": mySuccessFunc(),
    "onError": myErrorFunc( <string> )

ACC.push(["track:event", options, callbacks]);

The options <object> differ from each other. Each command has its own data to provided.

The callbacks <object>  will tell if your command has been validated and will be treated. In this case the  "onSuccess" provided function will be applied. Otherwise the  "onError" function will provide you a <string> expliciting the error.

For the sake of clarity, we will only tell how to set your options <object> for each command (as the callbacks object is generic and straightforward to understand).

Track leads


‘Lead’ events are useful to track behaviours such as sign-up, registrations etc. The Accengage advanced statistic dashboard will also measure these leads.

Options Required Type Description
lead required <string>


value required <string>  you can also provide "now()" as the value, it will automatically replace the string as a formatted date

The library provides a simple method to track leads. You might want to track particular special events and actions like an authentification. The type of a lead is 10, but you don’t need to specify it.

This is how to use the track:lead command:

For instance

ACC.push(["track:lead", {
    "lead": "foo",
    "value": "bar"

Track 'Add to Cart' events


‘Add to cart’ events are used to track and tag the fact that certain items were added to a basket. This is typically useful if you would like to set up “abandoned cart” campaigns, for which you will need to tag ‘add to cart’ events, as well as ‘purchases’.
The library provides a simple method to track items added to a cart. The type of all cart events is 30 but you don’t need to specify it.

This is how to use the track:cart command:

Options Required Type Description
item required <object>

The item <object> will respect this format:

    id: <string>
    price: <numeric>
    currency: <string>
    quantity: <numeric> [default: 1]
    label: <string> [optional]
    category: <string> [optional]
id optional <string> The id of your cart, it could match the id provided in a purchase track event

For instance

var myItem = {
    "id": "c22d2ea6-9184-11e7-abc4-cec278b6b50a",
    "price": 42,
    "currency": "EUR"

ACC.push(["track:cart", {
    "item": myItem

Track purchases


‘Purchase’ events are used to tag your users purchases within your site or target messages based on them, but also to measure the revenues generated thanks to your notification campaigns.

Indeed, Accengage provides a statistic dashboard which measures this information (Statistics > advanced statistics).

The library provides a simple method to track purchases. The type of all purchase events is 50, but you don’t need to specify it. It is recommended to specify all the purchased items.

This is how to use the track:purchase command:

Options Required Type Description
id required <string>


price required <numeric> please provide a valid number (NaN will not be a valid value)
currency required <string>  
items optional <array>

containing item <object> respecting this format:

    id: <string>
    price: <numeric>
    currency: <string>
    quantity: <numeric> [default: 1]
    label: <string> [optional]
    category: <stringg> [optional]

For instance

ACC.push(["track:purchase", {
    "id": "123456789",
    "price": 420,
    "currency": "EUR"

Track custom events


Apart from the special events seen above, you can tag and track any other event that will be useful for message targeting, thanks to custom events, such as ‘made a search’, ‘invited a friend’ etc.
For all of these custom events, use the track:event command.

Options Required Type Description
id required <numeric>

Please provide a valid number (NaN will not be a valid value)
Please note that you can create custom event in the Advanced Settings section of our interface

details optional <object> key - value set of data, used to details your event

For instance

ACC.push(["track:event", {"id": 1001}]);