DIL Modules dil-modules
Describes methods in the DIL.modules namespace. These modules let you programmatically collect data and work with Audience Manager objects.
siteCatalyst.init sitecat-init
Works with DIL to send Analytics tag elements (variables, props, eVars, etc.) to Audience Manager. Returns data in a comma separated list. Available in version 2.6.
Function Signature: DIL.modules.siteCatalyst.init(siteCatalystReportingSuite, dilInstance, trackVars, options)
s.t(); function.Parameters
namespageName , channel , campaign , product , etc.iteratedNamesprop1 , prop2 , evar3 , evar4 ).maxIndexmaxIndex:2 .siteCatalystReportingSuitedilInstanceoptionsAdditional options:
-
replaceContextDataPeriodsWithIf you do not specify something else, periods are replaced with the default underscore ( _ ).
For example
s.contextData = {abc.def = '123'}would result inc_contextData_abc_def=123in the event call query string.This option is available only in DIL version 5.0 or later.
-
filterFromContextVariablesFor example,
filterFromContextVariables: ['email', 'zip', 'accountNumber']would result in the array of strings being filtered from the data collection of context data. This option excludes Personally Identifiable Information (PII).
Data Captured by siteCatalyst.init
This function returns details on the following Analytics properties:
pageNamechannelcampaignproductseventseVar(1 - 250)prop(1 - 75)pepev1pev2pev3
Sample Code
This code creates a comma separated list of Analytics events (props, eVars, etc.) if values for them exist.
// Get the Site Catalyst object instance:
var s = s_gi(s_account);
// Instantiate DIL code:
var scDil = DIL.create({
partner: 'adobe',
containerNSID: 5
});
// Use the module:
DIL.modules.siteCatalyst.init(s, scDil, {
//Specify the Site Catalyst variables you want to capture:
names: ['pageName', 'channel', 'campaign'],
//Use this to create iterated variable names:
iteratedNames: [{
name: 'eVar',
maxIndex: 75
}, {
name: 'prop',
maxIndex: 75
}]
});
To track all the monitored Analytics data points without the additional function shown above, invoke siteCatalyst.init by itself like this:
DIL.modules.siteCatalyst.init(s, scDil);
GA.submitUniversalAnalytics ga-submit-universal-analytics
The GA.submitUniversalAnalytics(); function sends data from Google鈥檚 Universal Analytics to Audience Manager. This DIL function is designed to work with analytics.js, which is the latest code library for Google Universal Analytics.
-
Audience Manager does not have any insight into or control over the Google
analytics.jscode library. You should verify that DIL data collection is still working if or when Google releases new versions ofanalytics.js. -
You cannot use
GA.submitUniversalAnalytics();if you鈥檙e still working with Google鈥檚 legacy analytics tracking code (e.g.,ga.jsordc.js). See GA.init instead.
Function Signature: DIL.modules.GA.submitUniversalAnalytics(gaObject, dilInstance, internalPropertyName);
Properties
The GA.submitUniversalAnalytics(); function accepts the following properties.
gaObjectga by default, unless you've customized your Google Analytics code.dilInstanceinternalPropertyName(Optional) In the analytics.js library, the internal property is the minified variable 'b' . This variable holds Google Analytics data.
This property is optional because you don't need to set it unless Google changes the name of their internal variable. For example, if this minified variable changed to 'a' , you would call GA.submitUniversalAnalytics(); like this:
DIL.modules.GAsubmitUniversalAnalytics(ga, DilInstance, 'a');
Example
Remember to define the Google Analytics ga object first, before calling DIL and GA.submitUniversalAnalytics();. Your code could look similar to this:
//Instantiate DIL
var dilInstance = DIL.create({
partner:"adobe"
});
//Call the DIL Universal Analytics function
DIL.modules.GA.submitUniversalAnalytics(ga, dilInstance);
GA.init ga-init
The GA.init() function sends data from the legacy/deprecated version of Google Analytics to Audience Manager.
GA.init() only works with Google鈥檚 legacy analytics tracking code, ga.js or dc.js. You cannot invoke this DIL function if you use analytics.js, which is the latest code library for Google Universal Analytics. Audience Manager customers who use DIL and Universal Analytics should see GA.submitUniversalAnalytics.Function Signature: DIL.modules.GA.init(_gaq, dilInstance, trackVars);
Parameters
_gaqdilInstancetrackVarsnames property. This property is an array of GA command names that you want to track.Supported GA Function Calls
By default, GA.init captures data from the following functions:
_setCustomVar_addItem_addTrans_setAccount_trackSocial
DIL Creates Keys for GA Data
Audience Manager accepts data in the form of key-value pairs while GA works with items in an array. To work with GA data, DIL creates a key-value pair automatically and forms a key like this: c_ <key name>. Also, items in GA arrays appear in a specific order. As a result, you must supply all parameters in that order, even when they contain no data. DIL maps keys for the following GA methods:
// Tracking Social Interactions
_gaq.push(['_trackSocial',
'facebook', // c_socialNetwork
'like', // c_socialAction
'https://www.adobe.com/cool.php', // c_socialTarget
'/cool.php' // c_socialPagePath
]);
// Tracking a Transaction
_gaq.push(['_addTrans',
'1234', // c_transOrderId
'Womens Apparel', // c_transAfflication
'28.28', // c_transTotal
'1.29', // c_tranTax
'15.00', // c_transShipping
'San Jose', // c_transCity
'California', // c_transState
'USA' // c_transCountry
]);
// Tracking an item
_gaq.push(['_addItem',
'1234', // c_itemOrderId=1234
'DD44', // c_itemSku
'T-Shirt', // c_itemName
'Olive Medium', // c_itemCategory
'11.99', // c_itemPrice
'1' // c_itenQuantity
]);
Sample Code
// DIL JavaScript library needs to be loaded and executed here
var dilInstance = DIL.create({
partner : "adobe"
});
// Assume ga.js has not loaded
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-XXXXX-X'],
['_setDomainName', 'example.com'],
['_setCustomVar', 1, 'Section', 'Life & Style', 3],
['_trackPageview']
);
_gaq.push([
'_addItem',
'1234', // order ID - necessary to associate item with transaction
'DD44', // SKU/code - required
'T-Shirt', // product name - necessary to associate revenue with product
'Olive Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
]);
To track all the monitored GA metrics without the additional function shown above, invoke GA.init by itself like this:
DIL.modules.GA.init(_gaq, dilInstance).submit();
Sample Event Call
The URL event call to Audience Manager could look similar to this:
https://adobe.demdex.com/event?...c_accountId=UA-XXXXX-X&c_Section=Life%20%26%20Style &c_itemOrderId=1234&c_itemSku=DD44&c_itemName=T-Shirt&c_itemCategory=Olive%20Medium& c_itemPrice=11.99&c_itemQuantity=1