iOS Tagging

XtremePush has three methods for tagging activity in your app one for tagging page impression, one for tagging any other events for analytics and one for tracking realtime events to trigger In App Messages if needed.

Measure In App Events

To tag events for analytics and the ability to segment campaigns based on tag behaviour call the hitTag method where that event occurs as shown:

// You might for example want to tag a button press
[XPush hitTag: @"Checkout_Button_Pressed"];

To tag events 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"];

 

Special Tag Syntax 

Subscribe User's to Topics with an ON/OFF Flag

You can use a special syntax on your tag if you wish to track setting a Flag ON/OFF. A good example of when you might want to do this is if you have a push notification preferences page as in the example shown below.

Flag setting example

In the example shown you can set a flag on when the user selects Notify about full time scores as follows:

// Set full_time_score flag ON
[XPush hitTag: @"@on: full_time_score"];

If the user deselects this option you would unset it using the hitTag method call with the following syntax.

// Set full_time_score flag OFF
[XPush hitTag: @"@off: full_time_score"];

Any flags being set in your app using this approach can be targeted by creating a segment. From the example above to send messages to the users who have subscribed for full time score updates you would create: 

  • A segment called Full Time Score Subscribers
  • With the condition "Tagged attribute full_time_score Is on"
  • Add this segment to your full time score notifications

Below you can see an example of this segment being created in the segment manager on the platform. More information on segmentation can be found in the segmentation docs

 

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"];

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.

 

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:

  • For batching of tags call:

    [XPush setTagsBatchingEnabled:YES];

  • For batching of impressions call:

    [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];

To manually release impressions:

[XPush sendImpressions];

Have more questions? Submit a request

0 Comments

Article is closed for comments.