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 install date, last open date, number of visits, device model ...), it also offers a number of advanced tagging and tracking features for app developers, that will allow you to target notifications, trigger messages at the right time, customize the user experience and analyze your campaign and application 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 Accengage in order to speed up the process and learn faster, then implement the tagging plan at a later stage for more relevant messages.

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 are very useful for targeting and message personalization
  • tag user location, for geolocation targeting
  • tag user behaviours, thanks to events which offer many benefits (targeting, triggering and measurement), as well as views
  • register users to static lists, in order to manage preferences

If the information you would like to track is inside a webview, please see the Advanced section here

7.1 User profile

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

These are very 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}".

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, the values of these custom device info 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).

By implementing the library in your app, you will automatically gather certain information about your app users : their device model, OS version, language, country, time zone, app version, install 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.

If the information you would like to enrich is inside a webview, please see the Advanced section here.


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.

To enrich the user profile, and once the database scheme has been updated, you can add additional custom data (or User Attributes) using the updateDeviceInformation:withCompletionHandler: method.

First, create the device information set:

    Set, delete, increment or decrement the parameters (device information) in a following way:

      And finally call the appropriate SDK method:

        7.1.2 User geolocation

        You can benefit from your user's location data to target them using their past location.

        The location data are updated when the user opens the application.


        This user geolocation targeting is not to be confused with real-time geofencing which allows for campaign triggering based on real-time geolocation. See Geofence part.

        To update the user's current location, call the following method with a CLLocation object:

          7.1.3 Static lists subscriptions

          With Accengage, you can use two types of segments : Dynamic segments and Static lists.

          A Dynamic Segment is a segment which is defined by one or more criteria. Therefore, it may change as the values in the database are collected, imported, deleted and modified.

          A Static List is a set of mobile users whose volume is static at a given time.

          Unlike a Dynamic Segment whose volume can evolve according to the criteria defined in the interface, a Static List is a set of mobile users whose volume is static at a given time, in order, for example, to be used during a specific campaign or as an exclusion of a dynamic segment. Once created, a Static List can be populated through the SDK.

          The library provides several methods to manage the subscription to static lists.


          First, make sure that you've created your static list with an external_id. The external_id is required to populate your list through the SDK. To find out more, check out our guide.


          In order to subscribe a user to a Static List, create an ACCList object :

            You can also set a subscription expiration date. Once your subscription expires, the user will be removed from the Static List automatically.

              Add the user to a list or a set of lists :

                7.1.4 Subscription Tag

                A device tag has an identifier and a category associated with it. You can also add up to 5 parameters per tag.

                First, create the tag in a following way:

                  Add some parameters to the tag :

                    The tag can the be set (and later deleted if necessary) in a following way:

                      Device tag keys are unique therefore you need to use different ones when adding a set of values: 

                        You can set an expiration date for a device tag using a timestamp: 


                          Please note that this feature is only available through Accengage's API

                          For more information please contact our Support Team at

                          7.2 Behaviour tracking

                          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 : 

                                  The total 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 nil or empty you must specify the total purchase amount.


                                  The purchase_id must be unique. Otherwise, the tracking will be ignored by the server.

                                  Custom events

                                  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 thetrackEvent: method. 

                                  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 :


                                        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.


                                        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 trackScreenDismiss: in viewDidDisappear:.

                                            7.2.3 States

                                            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:

                                                7.3 Embedded web content tracking (in-app)

                                                If your application is hybrid and embeds webviews, you will probably want to tag certain information contained in your webviews.

                                                In that case, the regular methods of Update Device Information, or Events cannot be used, but tagging these information is possible if you follow the below instructions.


                                                In order to activate web content tracking, please contact your Accengage Project Manager for the exact procedure.

                                                First, follow one of those next steps depending on the component you're using: UIWebView or WKWebView.


                                                If you're using the UIWebView component, just replace it with the A4SWebView.


                                                If you're using the WKWebView component, you can simply replace it with the ACCWKWebView. But if you prefer avoiding the use of a subclass, you could implement the tracking manually.

                                                1. Inject the Accengage WKUserScript to your WKUserContentController 

                                                  • Add the handler for the Accengage messages 

                                                    • Initialize your WKWebView

                                                      • Handle the Accengage messages 

                                                          Once you've integrated the right component, you can now tag your web content.

                                                          To do so, follow this documentation.

                                                          Don't forget, as for regular custom user data or events, to declare them inside the Accengage dashboard.

                                                        • No labels