Our documentation is changing, please click here to enjoy it!

Skip to end of metadata
Go to start of metadata

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

In order to use the functions described below, you will need to create some commands within the Javascript. To see how to proceed, please read paragraph 3 of Section ‘Web SDK Integration’.

4.1 User Attributes

4.1.1 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…

Unlike events (see below), the values of these custom device info (or user attributes) are unique per user. This means the user's associated fields are single-value type fields and each update will erase currently stored values except when it's an incrementation (or decrementation).

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:

core:updateDeviceInfo

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

ArgumentRequiredTypeDescription
optionsyes<object>a list of fields <string> with value <string|number>
callbacksoptional<object>
  • "onSuccess" : <void> 
  • "onError" : <string> label error
For instance

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


4.1.2 User geolocation

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

This user geolocation targeting is not to be confused with real-time geofencing which is possible with mobile app push notifications, but not yet with web push notifications, even on mobile.

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):

 

Info

The value should respect a format which is available below

 

 

Params

4.2 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

 

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

 

4.2.1 Track leads

track:lead

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

OptionsRequiredTypeDescription
leadrequired<string>

 

valuerequired<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

4.2.2 Track 'Add to Cart' events

track:cart

‘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:

OptionsRequiredTypeDescription
itemrequired<object>

The item <object> will respect this format:

idoptional<string>The id of your cart, it could match the id provided in a purchase track event
For instance

4.2.3 Track purchases

track:purchase

‘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:

OptionsRequiredTypeDescription
idrequired<string>

 

pricerequired<numeric>please provide a valid number (NaN will not be a valid value)
currencyrequired<string> 
itemsoptional<array>

containing item <object> respecting this format:

For instance

4.2.4 Track custom events

track:event

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.

Event types below 1000 are reserved for the library internal usage.  You can use custom event types starting from 1001, and you must specify them

OptionsRequiredTypeDescription
idrequired<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

detailsoptional<object>key - value set of data, used to details your event
For instance

  • No labels