Ti.Omniture Module

Description

Provides access to the Omniture tracking and analytics service.

Dependencies

This iOS module requires iOS 6.0 or later. This Android module Requires Android 2.3.3 or later.

Omniture Resources

Getting Started

View the Using Titanium Modules document for instructions on getting started with using this module in your application.

Accessing the Module

Use require to access this module from JavaScript:

var Omniture = require("ti.omniture");

The Omniture variable is a reference to the Module object.

Breaking Changes

If you are upgrading from an earlier version of this module (prior to version 3.0.0) you should be aware that API of the module changed substantially to match the changes in the underlying native library.

Sessions and Basic Functions

The Ti.Omniture.Session class is no longer used. Instead of creating a Session object using the startSession function, basic parameters such as tracking server address and suite IDs are specified in a configuration file called ADBMobileConfig.json. Download a pre-configured instance of this file from the Adobe Mobile Services web site and place it into the platform/iphone folder (for iOS) and into the platform/android/bin/assets folder (for Android) of your Titanium Alloy project.

The functions of the Session class have been replaced with functions of the module object itself.

The name of many functions has changed to match the native library. Also, the way parameters are provided has changed to allow for a more concise coding style.

For example, this:

    session.trackAppState({
                appState: "state1",
                contextData: {
                        key: "value"
                }
    });

will become this:

    Omniture.trackState('state1', { key: 'value' });

Media Tracker

The Ti.Omniture.MediaTracker class is no longer used. Instead of creating a MediaTracker object using the startMediaTracker function, use the createMediaSettings function to create a Ti.Omniture.MediaSettings object and pass it to the mediaOpen function.

For example, this:

    var mediaTracker = Omniture.startMediaTracker({
        trackMilestones: "25,50,75",
        contextDataMapping: {
            "a.media.name": "eVar2,prop2",
            "a.media.segment": "eVar3",
            "a.contentType": "eVar1",
            "a.media.timePlayed": "event3",
            "a.media.view": "event1",
            "a.media.segmentView": "event2",
            "a.media.complete": "event7"
        }
    });

becomes this:

    var mediaSettings = Omniture.createMediaSettings({
        name: 'media1',
        milestones: '25,50,75',
        ...
    });
    Omniture.mediaOpen(mediaSettings);
    ...
    Omniture.mediaClose('media1');

Methods

<void> collectLifecycleData([contextData])

Begins the collection of lifecycle data. This should be the first method called upon app launch.

<void> trackState(state [, data])

Tracks a state with context data. This method increments page views.

<void> trackAction(action [, data])n

Tracks an action with context data. This method does not increment page views.

<void> trackActionFromBackground(action [, data])

Tracks an action with context data. This method does not increment page views. This method is intended to be called while your app is in the background (it will not cause lifecycle data to send if the session timeout has been exceeded).

<void>trackLocation(latitude, longitude[, data])

Tracks a location with context data. This method does not increment page views.

<void> trackLifetimeValueIncrease(amount[, data])

Tracks an increase in a user's lifetime value. This method does not increment page views.

<void> trackTimedActionStart(action[, data])

Tracks the start of a timed event. This method does not send a tracking hit If an action with the same name already exists it will be deleted and a new one will replace it.

<void> trackTimedActionUpdate(action[, data])

Tracks the start of a timed event. This method does not send a tracking hit. When the timed event is updated the contents of the parameter data will overwrite existing context data keys and append new ones.

<void> trackTimedActionEnd(action[, callback])

Tracks the end of a timed event

<Boolean> trackTimedActionExists(action)

Returns whether or not a timed action is in progress.

<void> retrieveVisitorMarketingCloudID(callback)

Retrieves the Marketing Cloud Identifier from the Visitor ID Service. Querying this property can cause a blocking network call, therefore this is an async function: the result will be delivered to the provided callback function.

<void> retrieveTrackingId(callback)

Retrieves the analytics tracking identifier. Querying this property can cause a blocking network call, therefore this is an async function: the result will be delivered to the provided callback function.

<void> trackingSendQueuedHits()

Force library to send all queued hits regardless of current batch options.

<void> trackingClearQueue()

Clears any hits out of the tracking queue and removes them from the database.

<Ti.Omniture.MediaSettings> createMediaSettings(props)

Creates a Ti.Omniture.MediaSettings object with the specified properties.

The following properties are mandatory:

<Ti.Omniture.MediaSettings> createMediaAdSettings(props)

Creates a Ti.Omniture.MediaSettings object with the specified properties.

The following properties are mandatory:

The difference between createMediaSettings and this function is that this function sets isMediaAd to true by default.

<void> mediaOpen(mediaSettings[, callback])

Opens a media item for tracking.

<void> mediaClose(name)

Closes a media item.

<void> mediaPlay(name, offset)

Begins tracking a media item.

<void> mediaComplete(name, offset)

Artificially completes a media item.

<void> mediaStop(name, offset)

Notifies the media module that the media item has been paused or stopped.

<void> mediaClick(name, offset)

Notifies the media module that the media item has been clicked.

<void> mediaTrack(name[, contextData])

Sends a track event with the current media state

<void> targetLoadRequest(request, callback)

Processes a Target service request.

<TiOmnitureTargetLocationRequest> createTargetLocationRequest(params)

Creates a Ti.Omniture.TargetLocationRequest object.

<TiOmnitureTargetLocationRequest> createTargetOrderConfirmRequest(params)

Creates a Ti.Omniture.TargetLocationRequest object.

<void> targetClearCookies()

Clears target cookies from shared cookie storage.

<void> setAudienceIds(dpid, dpuuid)

Sets the DPID and DPUUID.

<void> audienceSignalWithData(data[, callback])

Processes an Audience Manager service request.

<void> audienceReset()

Resets audience manager UUID and purges current visitor profile.

<void> visitorSyncIdentifiers(identifiers)

Synchronizes the provided identifiers to the visitor id service

Properties

version : String

The version of the Omniture library.

userIdentifier : String

The custom user identifier.

Note : If your app upgrades from the Marketing Cloud 3.x to 4.x SDK, the previous visitor ID (either custom or automatically generated) is retrieved and stored as the custom user identifier. This preserves visitor data between upgrades of the SDK. For new installations on the 4.x SDK, user identifier is null until set.

debugLogging : Boolean

Enables or disables debug logging.

lifetimeValue : Number

The user's current lifetime value.

trackingQueueSize : Number

The number of hits currently in the tracking queue.

privacyStatus : Number

The privacy status.

audienceVisitorProfile : Object

The visitor's profile.

audienceDpid: String

A string containing the DPID value.

audienceDpuuid: String

A string containing the DPUUID value.

PRIVACY_STATUS_OPT_IN : Number

One of the possible values of the privacyStatus property.

PRIVACY_STATUS_OPT_OUT : Number

One of the possible values of the privacyStatus property.

PRIVACY_STATUS_OPT_UNKNOWN : Number

One of the possible values of the privacyStatus property.

TARGET_PARAM_ORDER_ID : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_ORDER_TOTAL : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_PRODUCT_PURCHASE_ID : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_CATEGORY_ID : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_MBOX_3RD_PARTY_ID : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_MBOX_PAGE_VALUE : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_MBOX_PC : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_MBOX_SESSION_ID : String

Constant string that can be used as keys to add common target parameters.

TARGET_PARAM_MBOX_HOST : String

Constant string that can be used as keys to add common target parameters.

Usage

See example.

Author

Original: Jeff Haynie, Fred Spencer, & Jon Alter

Rewrite based on 4.x: Zsombor Papp

Module History

View the change log for this module.

Feedback and Support

Please direct all questions, feedback, and concerns to info@appcelerator.com.

License

Copyright(c) 2010-2015 by Appcelerator, Inc. All Rights Reserved. Please see the LICENSE file included in the distribution for further details.