TOPICS×
DIL Modules
Describes methods in the
DIL.modules
namespace. These modules let you programmatically collect data and work with Audience Manager objects.
siteCatalyst.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)
You must place this code on the page
before
the
s.t();
function.
Parameters
Names | Type | Description |
---|---|---|
names | String | An array of strings that contains un-enumerated
Analytics
variables like
pageName
,
channel
,
campaign
,
product
, etc.
|
iteratedNames | Object | An array of objects that contains enumerated
Analytics
variables like props and evars (e.g.
prop1
,
prop2
,
evar3
,
evar4
).
|
maxIndex | Integer | Indicates how many iterated names you want to return. For example, to return two props or evars, set
maxIndex:2
.
|
siteCatalystReportingSuite | Object | An object that represents the
Analytics
object.
|
dilInstance | Object | An object that represents
DIL
.
|
options | Object | Additional options:
|
Data Captured by siteCatalyst.init
This function returns details on the following Analytics properties:
- pageName
- channel
- campaign
- products
- events
- eVar (1 - 250)
- prop (1 - 75)
- pe
- pev1
- pev2
- pev3
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
The
GA.submitUniversalAnalytics();
function sends data from Google's 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.js code library. You should verify that DIL data collection is still working if or when Google releases new versions of analytics.js .
- You cannot use GA.submitUniversalAnalytics(); if you're still working with Google's legacy analytics tracking code (e.g., ga.js or dc.js ). See GA.init instead.
Function Signature:
DIL.modules.GA.submitUniversalAnalytics(gaObject, dilInstance, internalPropertyName);
Properties
The
GA.submitUniversalAnalytics();
function accepts the following properties.
Property | Description |
---|---|
gaObject
| The global variable for your instance of
Google Analytics
. This is usually
ga
by default, unless you've customized your
Google Analytics
code.
|
dilInstance
| The variable that represents your instance of
DIL
.
|
internalPropertyName
| (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
The
GA.init()
function sends data from the legacy/deprecated version of Google Analytics to Audience Manager.
GA.init()
only works with Google's 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
Name
| Type
| Description
|
---|---|---|
_gaq
| Array
| An array that contains GA commands.
|
dilInstance
| Object
| An object that contains the DIL instance.
|
trackVars
| Object
| (Optional)
An object that consists of the
names
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