7.2.1 Events tracking
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 :
- In-app message or local push real-time triggering
- Application or campaign performance measuring
- Message targeting (subject to your app being integrated in the new platform).
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 triggers or targeting options.
Events are composed of a type (a numeric value which categorizes the type of event - see below), and parameters, which brings more information and can be targeted on (provided you are on the new platform).
The library offers specific and useful methods to track standard events such as "add to cart" events, "purchases" or "leads". You can also track custom events for other user behaviors.
The specified currency for cart and purchase tracking must be compliant with the current link ISO-4217 standard. If not, the tracking will be ignored.
Add to cart
"Add to cart" events are useful 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. For example, an iPhone 7 added to a new cart, can be tracked with:
If the user adds a new item to the same cart, you should use the same
cart_id. For example, if he also adds an iPhone 7 Case to the same cart as the iPhone 7, track it with:
"Purchase" events are very useful to tag your user's purchases within your app, to trigger or target messages based on them, but also to measure the revenues generated overall within your app, and 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. For example, the purchase of the previous cart, can be tracked with :
"Lead" events are useful to track behaviours such as sign-up, registrations etc. The Accengage advanced statistic dashboard will also measure these leads.
The library also provides a simple method to track leads. You might want to track particular special event and action like an
authentification. The type of a lead is
10 , but once again you don't need to specify it.
For example, a sign-up event, can be tracked with :
amount is optional when the purchased items are detailed. In this case, the server will calculate it for you. But, if the items set is
empty you must specify the total purchase amount.
purchase_id must be unique. Otherwise, the tracking will be ignored by the server.
Apart from the special events seen above, you can tag and track any other event that will be useful for message triggering or targeting, thanks to custom events, such as "clicked on a certain button", "made a search, "invited a friend" etc.
For all of these custom events, use the
Events types below
1000 are reserved for the library internal usage. You can use custom event types starting from
1001, and you must specify them.
Please note that the length of your concatenated parameters is restricted to 1024 characters : if you exceed this limitation, the SDK will truncate the value.
Create a CustomEventParams object
Add parameters to CustomEventParams object
Four types of parameters are supported : NSString, NSNumber, BOOL and NSDate.
Track the event
Finally you can track the event you just created by using the Accengage's class trackEvent method :
Note Each event needs to be defined in the Accengage User Interface. Go to Settings > Advanced Settings, and add a new event of type
Custom with the code used in
trackEvent method. The label is only used for a display purpose.
Each event needs to be defined in the Accengage User Interface. Go to Settings > Advanced Settings, and add a new event of type
In order to offer the best user experience, and let you trigger in-app messages at the most relevant time, on the right view (or avoid displaying them on certain views), the Accengage library allows you to track screens or views within your app.
Unlike events, view tracking is not reported to our servers.
Don't forget to configure your views in the Accengage dashboard (settings > settings > add a view) to display an understandable label for your product or marketing teams, and so that they can select them.
We recommend exhaustively tracking every visible view in your app.
The library offers an easy way to track a screen display and dismiss, you just need to import the
Accengage.h and set the
accengageAlias in the viewDidLoad: method:
But if you prefer to track screens manually, you'll need to call the method
trackScreenDisplay: in the
viewDidAppear: method of your controller and the
States allow you to trigger in-app messages or scheduled alarms.
To use this feature, you need to declare the states on Accengage dashboard (Settings > States) and then use them as a trigger.
To set a state:
To delete a state: