iOS Event Templates

Overview

The Urban Airship Event Templates provide a way to create custom events for common account, media or retail-related events. They are a wrapper for Custom Events.

Resources

Templates

UAAccountEventTemplate

This template creates a custom event for account-related events, such as a user registering for a paid premium account. Create and track the following events:

Account registered event

let acctTemplate = UAAccountEventTemplate.registeredTemplate()
let acctEvent = acctTemplate.createEvent()
acctEvent.track()

UAAccountEventTemplate *acctTemplate = [UAAccountEventTemplate registeredTemplate];
UACustomEvent *acctEvent = [acctTemplate createEvent];
[acctEvent track];

Account registered event with optional properties

let acctTemplate = UAAccountEventTemplate.registeredTemplate(withValue: 9.99)
acctTemplate.transactionID = "12345"
acctTemplate.category = "Premium"
let acctEvent = acctTemplate.createEvent()
acctEvent.track()
UAAccountEventTemplate *acctTemplate = [UAAccountEventTemplate registeredTemplateWithValue:@(9.99)];
acctTemplate.transactionID = @"12345";
acctTemplate.category = @"Premium";
UACustomEvent *acctEvent = [acctTemplate createEvent];
[acctEvent track];

UAMediaEventTemplate

This template creates a custom event for media-related events, such as a user playing a video, listening to an audio track, reading an article, sharing content, or starring content as a favorite. Create and track the following events:

Consumed content event

let mediaTemplate = UAMediaEventTemplate.consumed()
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate consumedTemplate];
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Consumed content event with an optional value

let mediaTemplate = UAMediaEventTemplate.consumedTemplate(withValue: 1.99)
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate consumedTemplateWithValue:@(1.99)];
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Consumed content event with optional properties

let mediaTemplate = UAMediaEventTemplate.consumedTemplate(withValue: 2.99)
mediaTemplate.category = "entertainment"
mediaTemplate.identifier = "12322"
mediaTemplate.eventDescription = "Watching latest entertainment news."
mediaTemplate.type = "video"
mediaTemplate.author = "UA Enterprises"
mediaTemplate.isFeature = true
mediaTemplate.publishedDate = "August 25, 2016"
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate consumedTemplateWithValue:@(2.99)];
mediaTemplate.category = @"entertainment";
mediaTemplate.identifier = @"12322";
mediaTemplate.eventDescription = @"Watching latest entertainment news.";
mediaTemplate.type = @"video";
mediaTemplate.author = @"UA Enterprises";
mediaTemplate.isFeature = YES;
mediaTemplate.publishedDate = @"August 25, 2016";
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Starred content event

let mediaTemplate = UAMediaEventTemplate.starred()
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate starredTemplate];
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Starred content event with optional properties

let mediaTemplate = UAMediaEventTemplate.starred()
mediaTemplate.category = "entertainment"
mediaTemplate.identifier = "1234"
mediaTemplate.eventDescription = "Watching latest entertainment news."
mediaTemplate.type = "video"
mediaTemplate.author = "UA Enterprises"
mediaTemplate.isFeature = true
mediaTemplate.publishedDate = "August 25, 2016"
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate starredTemplate];
mediaTemplate.category = @"entertainment";
mediaTemplate.identifier = @"1234";
mediaTemplate.eventDescription = @"Watching latest entertainment news.";
mediaTemplate.type = @"video";
mediaTemplate.author = @"UA Enterprises";
mediaTemplate.isFeature = YES;
mediaTemplate.publishedDate = @"August 25, 2016";
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Browsed content event

let mediaTemplate = UAMediaEventTemplate.browsed()
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate browsedTemplate];
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Browsed content event with optional properties

let mediaTemplate = UAMediaEventTemplate.browsed()
mediaTemplate.category = "entertainment"
mediaTemplate.identifier = "1234"
mediaTemplate.eventDescription = "Browsed latest entertainment news."
mediaTemplate.type = "video"
mediaTemplate.author = "UA Enterprises"
mediaTemplate.isFeature = true
mediaTemplate.publishedDate = "August 25, 2016"
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate browsedTemplate];
mediaTemplate.category = @"entertainment";
mediaTemplate.identifier = @"1234";
mediaTemplate.eventDescription = @"Browsed latest entertainment news.";
mediaTemplate.type = @"video";
mediaTemplate.author = @"UA Enterprises";
mediaTemplate.isFeature = YES;
mediaTemplate.publishedDate = @"August 25, 2016";
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Shared content event

let mediaTemplate = UAMediaEventTemplate.shared()
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate sharedTemplate];
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Shared content event with optional Facebook source and social medium

let mediaTemplate = UAMediaEventTemplate.sharedTemplate(withSource: "facebook", withMedium: "social")
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate sharedTemplateWithSource:@"facebook" withMedium:@"social"];
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

Shared content event with optional properties

let mediaTemplate = UAMediaEventTemplate.sharedTemplate(withSource: "facebook", withMedium: "social")
mediaTemplate.category = "entertainment"
mediaTemplate.identifier = "1234"
mediaTemplate.eventDescription = "Watching latest entertainment news."
mediaTemplate.type = "video"
mediaTemplate.author = "UA Enterprises"
mediaTemplate.isFeature = true
mediaTemplate.publishedDate = "August 25, 2016"
let mediaEvent = mediaTemplate.createEvent()
mediaEvent.track()
UAMediaEventTemplate *mediaTemplate = [UAMediaEventTemplate sharedTemplateWithSource:@"facebook" withMedium:@"social"];
mediaTemplate.category = @"entertainment";
mediaTemplate.identifier = @"1234";
mediaTemplate.eventDescription = @"Watching latest entertainment news.";
mediaTemplate.type = @"video";
mediaTemplate.author = @"UA Enterprises";
mediaTemplate.isFeature = YES;
mediaTemplate.publishedDate = @"August 25, 2016";
UACustomEvent *mediaEvent = [mediaTemplate createEvent];
[mediaEvent track];

UARetailEventTemplate

This template creates a custom event for retail-related events, such as a user browsing a product, adding an item to a cart, purchasing an item, starring a product as a favorite, or sharing a product. Create and track the following events:

Purchased event

let retailTemplate = UARetailEventTemplate.purchased()
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate purchasedTemplate];
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Purchased event with optional properties

let retailTemplate = UARetailEventTemplate.purchasedTemplate(withValue: 99.99)
retailTemplate.category = "mens shoes"
retailTemplate.identifier = "12345"
retailTemplate.eventDescription = "Low top"
retailTemplate.transactionID = "13579"
retailTemplate.brand = "SpecialBrand"
retailTemplate.isNewItem = true
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate purchasedTemplateWithValue:@(99.99)];
retailTemplate.category = @"mens shoes";
retailTemplate.identifier = @"12345";
retailTemplate.eventDescription = @"Low top";
retailTemplate.transactionID = @"13579";
retailTemplate.brand = @"SpecialBrand";
retailTemplate.isNewItem = YES;
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Browsed event

let retailTemplate = UARetailEventTemplate.browsed()
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate browsedTemplate];
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Browsed event with optional properties

let retailTemplate = UARetailEventTemplate.browsedTemplate(withValue: 99.99)
retailTemplate.category = "mens shoes"
retailTemplate.identifier = "12345"
retailTemplate.eventDescription = "Low top"
retailTemplate.transactionID = "13579"
retailTemplate.brand = "SpecialBrand"
retailTemplate.isNewItem = true
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate browsedTemplateWithValue:@(99.99)];
retailTemplate.category = @"mens shoes";
retailTemplate.identifier = @"12345";
retailTemplate.eventDescription = @"Low top";
retailTemplate.transactionID = @"13579";
retailTemplate.brand = @"SpecialBrand";
retailTemplate.isNewItem = YES;
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Added-to-cart event

let retailTemplate = UARetailEventTemplate.addedToCart()
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate addedToCartTemplate];
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Added-to-cart event with optional properties

let retailTemplate = UARetailEventTemplate.addedToCartTemplate(withValue: 99.99)
retailTemplate.category = "mens shoes"
retailTemplate.identifier = "12345"
retailTemplate.eventDescription = "Low top"
retailTemplate.transactionID = "13579"
retailTemplate.brand = "SpecialBrand"
retailTemplate.isNewItem = true
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate addedToCartTemplateWithValue:@(99.99)];
retailTemplate.category = @"mens shoes";
retailTemplate.identifier = @"12345";
retailTemplate.eventDescription = @"Low top";
retailTemplate.transactionID = @"13579";
retailTemplate.brand = @"SpecialBrand";
retailTemplate.isNewItem = YES;
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Starred product event

let retailTemplate = UARetailEventTemplate.starredProduct()
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate starredProductTemplate];
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Starred product event with optional properties

let retailTemplate = UARetailEventTemplate.starredProductTemplate(withValue: 99.99)
retailTemplate.category = "mens shoes"
retailTemplate.identifier = "12345"
retailTemplate.eventDescription = "Low top"
retailTemplate.transactionID = "13579"
retailTemplate.brand = "SpecialBrand"
retailTemplate.isNewItem = true
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate starredProductTemplateWithValue:@(99.99)];
retailTemplate.category = @"mens shoes";
retailTemplate.identifier = @"12345";
retailTemplate.eventDescription = @"Low top";
retailTemplate.transactionID = @"13579";
retailTemplate.brand = @"SpecialBrand";
retailTemplate.isNewItem = YES;
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Shared product event

let retailTemplate = UARetailEventTemplate.sharedProduct()
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate sharedProductTemplate];
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Shared product event with optional Facebook source and social medium

let retailTemplate = UARetailEventTemplate.sharedProductTemplate(withSource: "facebook", withMedium: "social")
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate sharedProductTemplateWithSource:@"facebook" withMedium:@"social"];
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];

Shared product event with optional properties

let retailTemplate = UARetailEventTemplate.sharedProductTemplate(withSource: "facebook", withMedium: "social")
retailTemplate.category = "mens shoes"
retailTemplate.identifier = "12345"
retailTemplate.eventDescription = "Low top"
retailTemplate.transactionID = "13579"
retailTemplate.brand = "SpecialBrand"
retailTemplate.isNewItem = true
let retailEvent = retailTemplate.createEvent()
retailEvent.track()
UARetailEventTemplate *retailTemplate = [UARetailEventTemplate sharedProductTemplateWithSource:@"facebook" withMedium:@"social"];
retailTemplate.category = @"mens shoes";
retailTemplate.identifier = @"12345";
retailTemplate.eventDescription = @"Low top";
retailTemplate.transactionID = @"13579";
retailTemplate.brand = @"SpecialBrand";
retailTemplate.isNewItem = YES;
UACustomEvent *retailEvent = [retailTemplate createEvent];
[retailEvent track];