Smartech

Configuring Analytics via Omniture

Step 1: Create new Class

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

public static void trackAction(String eventName, HashMap<String, Object> properties) {
        //Please pass the string "omni" for vendor if you are using Omniture to track the event.
        HashMap<String, String> hanselData = HanselTracker.logEvent(eventName, "omni", properties);
        if (properties == null) {
            properties = new HashMap<>();
        }
        properties.putAll(hanselData);
        Analytics.trackAction(eventName, properties);
    }

    public static void trackState(String eventName, HashMap<String, Object> properties) {
        //Please pass the string "omni" for vendor if you are using Omniture to track the event.
        HashMap<String, Object> hanselData = HanselTracker.logEvent(eventName, "omni", properties);
        if (properties == null) {
            properties = new HashMap<>();
        }
        properties.putAll(hanselData);
        Analytics.trackState(eventName, properties);
    }
fun trackAction(eventName: String, properties: HashMap<String, Any>) {
        //Please pass the string "omni" for vendor if you are using Omniture to track the event.
        val hanselData = HanselTracker.logEvent(eventName, "omni", properties)
        properties.putAll(hanselData)
        Analytics.trackAction(eventName, properties)
    }

    fun trackState(eventName: String, properties: HashMap<String, Any>) {
        //Please pass the string "omni" for vendor if you are using Omniture to track the event.
        val hanselData = HanselTracker.logEvent(eventName, "omni", properties)
        properties.putAll(hanselData)
        Analytics.trackState(eventName, properties)
    }
import {NativeModules} from 'react-native';

var AppOmniture = (function () {
  function trackAction(omnitureClient, eventName, properties) {
    var mergedProperties = {};
    NativeModules.HanselTrackerRn.logEvent(eventName,"omni",properties,(hanselData) => {
        if(!properties) {properties = {};}
        mergedProperties = Object.assign(properties, hanselData);   
    });
    omnitureClient.trackAction(eventName, mergedProperties);
  }
  
  function trackState(omnitureClient, eventName, properties) {
    var mergedProperties = {};
    NativeModules.HanselTrackerRn.logEvent(eventName,"omni",properties,(hanselData) => {
        if(!properties) {properties = {};}
        mergedProperties = Object.assign(properties, hanselData);   
        omnitureClient.trackState(eventName, mergedProperties);
    });
  }
})();

Step 2: Tracking Hansel changes

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

//If the original code was
Analytics.trackAction(eventName, properties);
//or
Analytics.trackState(eventName, properties);

//it would get updated to
AppOmniture.trackAction(eventName, properties);
//or
AppOmniture.trackState(eventName, properties);
//If the original code was
Analytics.trackAction(eventName, properties);
//or
Analytics.trackState(eventName, properties);

//it would get updated to
AppOmniture.trackAction(eventName, properties);
//or
AppOmniture.trackState(eventName, properties);
//If the original code was
omnitureClient.trackAction(eventName, properties);
//or
omnitureClient.trackState(eventName, properties);

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

Updated about a month ago


Next

You are done configuring analytics events for triggers and goals, go back to this page and follow further steps to complete the Product Experience integration!

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.