Smartech

Configuring Analytics via Omniture

Step 1: Create new Class

Create a new class "AppOmniture" and add the following method to it.

#import <SmartechNudges/Hansel-umbrella.h>

+ (void) trackState:(NSString *)eventName data:(id)properties{
    //Check if this event is being tracked in any one of the Hansel Interaction Maps.
   //Please pass the string "omni" for vendor if you are using Omniture to track the event.
   //get the data for all Interaction Maps created on hansel dashboard.
    NSDictionary* hanselData = [HanselTracker logEvent:eventName andVendor:@"omni" withProperties:properties];
    if (![properties isKindOfClass:[NSMutableDictionary class]]){
        properties = [properties mutableCopy];
    }
    [properties addEntriesFromDictionary:hanselData];
    [ADBMobile trackState:eventName data:properties];
}
+ (void) trackAction:(NSString *)eventName data:(id)properties{
    //Check if this event is being tracked in any one of the Hansel Interaction Maps.
   //Please pass the string "omni" for vendor if you are using Omniture to track the event.
   //get the data for all Interaction Maps created on hansel dashboard.
    NSDictionary* hanselData = [HanselTracker logEvent:eventName andVendor:@"omni" withProperties:properties];
    if (![properties isKindOfClass:[NSMutableDictionary class]]){
        properties = [properties mutableCopy];
    }
    [properties addEntriesFromDictionary:hanselData];
    [ADBMobile trackAction:eventName data:properties];
}
class func trackState(_ eventName: String, properties: [AnyHashable: Any]?) {
        var properties = properties
        //Check if this event is being tracked in any one of the active Hansel Interaction Maps
        //Please pass the string "omni" for vendor if you are using Omnniture to track the event.
        //getting the data for all interaction maps on hansel dashboard
              let hanselData = HanselTracker.logEvent(eventName, vendor: "omni", withProperties: properties)
            for (k, v) in hanselData { properties[k] = v }  
        ADBMobile.trackState(eventName, data: properties)
    }

 class func trackAction(_ eventName: String, properties: [AnyHashable: Any]?) {
        var properties = properties
        //Check if this event is being tracked in any one of the active Hansel Interaction Maps
        //Please pass the string "omni" for vendor if you are using Omnniture to track the event.
        //getting the data for all interaction maps on hansel dashboard
              let hanselData = HanselTracker.logEvent(eventName, vendor: "omni", withProperties: properties)
            for (k, v) in hanselData { properties[k] = v }  
        ADBMobile.trackAction(eventName, data: properties)
}

Step 2: Update code

For all those events on which you want to track the impact of Hansel changes, make the updates as suggested in the snippet below:

#import <SmartechNudges/Hansel-umbrella.h>

//If the original code was
[ADBMobile trackState:eventName data:properties];
//or
[ADBMobile trackAction:eventName data:properties];

//it would get updated to
[AppOmniture trackState:eventName data:properties];
//or
[AppOmniture trackAction:eventName data:properties];
//If the original code was
ADBMobile.trackState(eventName, data: properties)
//or
ADBMobile.trackAction(eventName, data: properties)

//it would get updated to
AppOmniture.trackState(eventName, properties: properties)
//or
AppOmniture.trackAction(eventName, properties: properties)

Updated 6 months ago


Next

Continue setting up Product experience

Product Experience

Configuring Analytics via Omniture


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.