iOS tagging
Track your user's activity in your iOS app
Xtremepush has several methods for tagging activity in your app which allow you to tag page impressions, any other interactions for analytics, user attributes and realtime events to trigger in app messages if needed.
Tagging interactions
To tag interactions for analytics and the ability to segment campaigns based on tag behaviour, call the hitTag
method where that interaction occurs as shown:
// You might for example want to tag a button press
XPush.hitTag("Checkout_Button_Pressed")
// You might for example want to tag a button press
[XPush hitTag: @"Checkout_Button_Pressed"];
To tag interactions that capture a value and grab the value, use the hitTag
method with the withValue
option, for example:
// You might for example want to capture a form being filled out
XPush.hitTag("form_1_field_1", withValue: "form_data")
// You might for example want to capture a form being filled out
[XPush hitTag:@"form_1_field_1" withValue:@"form_data"];
Page tagging for tracking page impressions
To tag page impressions call the hitImpression
method where your page loads:
// Send impression to server to track page impressions
XPush.hitImpression("Page_Title")
// Send impression to server to track page impressions
[XPush hitImpression: @"Page_Title"];
The tag used to record a page impression should uniquely identify a page and it can be set programatically in apps with content that updates dynamically from a feed so that page impressions are crew.
Setting user attributes
To associate custom attributes against your user's profile you can use the following SDK method:
// You can send any available attribute
XPush.hitTag("user_attribute", withValue: ATTRIBUTE)
// like a users first name
XPush.hitTag("first_name", withValue: "Zoe")
// or their loyalty points balance
XPush.hitTag("xp_points", withValue: "500")
// You can send any available attribute
[XPush hitTag:@"user.attribute" withValue: ATTRIBUTE];
// like a users first name
[XPush hitTag:@"user.first_name" withValue: @"Zoe"];
// or their loyalty points balance
[XPush hitTag:@"user.xp_points" withValue: @"500"];
Attributes can be used in both for segmentation and for personalisation.
Batching of tags
The default behaviour for Tags is that they are sent immediately, if you want to control how chatty your app is you can enable batching.
To turn on batching you can call the following methods when initialising XtremePush in your AppDelegate:
Tags batching
For batching of tags call:
XPush.tagsBatchingEnabled = true
[XPush setTagsBatchingEnabled:YES];
Impressions batching
For batching of impressions call:
XPush.impressionsBatchingEnabled = true
[XPush setImpressionsBatchingEnabled:YES];
With batching turned on tags or impressions will be cached when you call hitTag or hitImpression and released when you exit your app or when you call the sendTags
or sendImpressions
methods, as shown below:
- To manually release tags:
XPush.sendTags()
[XPush sendTags];
- To manually release impressions:
XPush.sendImpressions()
[XPush sendImpressions];
Updated about 3 years ago