DTM Product variable questions

JillsMatthew

13-07-2016

Hi,

Just started working on DTM (Adobe Activation) and I have a few questions regarding the rule setup. Hope someone from the community can help me here

  1. How can I set products variable in page load rule?
  2. How can I set product variable in event based rules (i.e. link tracking)
  3. How can I set a global linkTrackVars (i.e. a list of variables that must be sent in *every* link tracking (s.tl) call
  4. How can I set multiple products in the same tracking call?

Thanks in advance for any feedback

J

Accepted Solutions (1)

Accepted Solutions (1)

ParitMittal

19-07-2016

Hi Jills ,

Please find below my comments in Italic to answer your queries. 

1. How can I set a global linkTrackVars (i.e. a list of variables that must be sent in *every* link tracking (s.tl) call
While using the s_code.js file we were using, s.linkTrackVars="eVar1,eVar2" in the global js file configuration section and then in the custom link tracking code we will add s.linkTrackVars+ =",eVar3,eVar4". In this way, we will have eVar1 and eVar2 sent in all custom link tracking call. Is there such a feature available in DTM? Or do I need to add those variables individually in every event based s.tl rules? 

 

// In DTM ,To set the global linkTrackVars we take the same approach i.e. you have to specify the  s.linkTrackVars="eVar1,eVar2" in App Measurement file hosted in DTM or if the library file is managed by Adobe then you have to specify the same in "Custom Page Code"  of the Analytics tools using the option "After UI settings takes place". 

 

2. How can I set multiple products in the same tracking call?
What I meant here was: How can I create a dynamic (or array) data element for products in DTM to track multiple values from same page?
e.g. I have three products displayed on a page. I need to send these products to Omniture for track product views.
It may be possible to use the code s.products=";"  + _satellite.getVar("ProductID1,")+";"  + _satellite.getVar("ProductID2,")+";"  + _satellite.getVar("ProductID3"); but I'm sure this is not the correct way of doing it. What if there are 5 products on page, or 50 products? How can I track all listed products in DTM?

 

// To Achieve the same , Please create a data element  "ProdArray" of type "Custom Script " like below to store all the Products Viewed on a page in an array and then return the array from custom script. var Product_array=new Array() ; Product_array[0]="ID1";// Write your own custom logic to fetch product Id's from the HTML of page or data layer and store them in the array Product_array[1]="ID2";// Write your own custom logic to fetch product Id's from the HTML of page or data layer and store them in the array 
return Product_array;

On the Product Page Load rule, In  Adobe Analytics custom code section  write your own logic like below :

var data_view= _satellite.getVar('ProdArray'); if(data_view!="") { for(var x_view=0, xlen_view=data_view.length;x_view<xlen_view;x_view++){ if(x_view==0) { product_view=";" + data_view[x_view]; } else { product_view=product_view+ ","+";" +data_view[x_view]; } } } s.linkTrackVars = 'products'; s.linkTrackEvents = 'ProdView'; s.events="ProdView" s.products=product_view ; }

Thanks& Regards

Parit Mittal

Answers (3)

Answers (3)

ParitMittal

14-07-2016

Hi ,

Thanks for reaching out to Adobe Community. Please see my answers inline to your questions below :

  • How can I set products variable in page load rule?

          Let's say that On the Product Display Page , you want to fire a Page Load rule and in the Page load rule you want to fire a product view event with the Product SKU ID. Hence to achieve the same , Under Adobe Analytics tab select event as "prodView" and in the custom code section Enter the below code :

s.products=";"  + _satellite.getVar("ProductID"); // ProductID is a data element set on the Product display  page
  • How can I set product variable in event based rules (i.e. link tracking)

Let's say that On the Product Display Page , you want to fire a Event rule on the click of "Add to Cart " button  and in the Event rule you want to fire a ScAdd event with the Product SKU ID. Hence to achieve the same , Under Adobe Analytics tab  in the custom code section Enter the below code :

var check_data = readCookie('simpleCart').split('++'); var cart_no_of_items=check_data.length; console.log(cart_no_of_items); var id= _satellite.getVar("ProductID"); if (cart_no_of_items >1) { s.linkTrackVars = 'products'; s.linkTrackEvents = 'scAdd'; s.events="scAdd" s.products= ";"+id; } else { s.linkTrackVars = 'products,'; s.linkTrackEvents = 'scAdd,scOpen'; s.events="scAdd,scOpen" s.products= ";"+id;; } //The Above code reads the cart cookie and check if the no of items in the the cart are greater than 1 or not
  • How can I set a global linkTrackVars (i.e. a list of variables that must be sent in *every* link tracking (s.tl) call

    There is nothing called global link Track Vars  if we do not set s.linkTrackvars  In Link tracking call  then all the variable that are set on the page from which link tracking call is fired are also passed with link tracking call. To avoid the same it is strongly recommended to use s.linktrackvars to specify the variables to be tracked in link tracking calls we can 

  • How can I set multiple products in the same tracking call?

To Set multiple product please set the product variable in the following way : 

s.events="prodView"
s.products="Footwear;Running Shoes,;Running Socks"

Also, see the following link for more information

https://marketing.adobe.com/resources/help/en_US/sc/implement/products.html

Please let us know in case of any questions

Thanks & Regards

Parit Mittal

JillsMatthew

18-07-2016

Hi Parit,

Thanks for the details.

  • How can I set a global linkTrackVars (i.e. a list of variables that must be sent in *every* link tracking (s.tl) call
    While using the s_code.js file we were using, s.linkTrackVars="eVar1,eVar2" in the global js file configuration section and then in the custom link tracking code we will add s.linkTrackVars+ =",eVar3,eVar4". In this way, we will have eVar1 and eVar2 sent in all custom link tracking call. Is there such a feature available in DTM? Or do I need to add those variables individually in every event based s.tl rules?

 

  • How can I set multiple products in the same tracking call?
    What I meant here was: How can I create a dynamic (or array) data element for products in DTM to track multiple values from same page?
    e.g. I have three products displayed on a page. I need to send these products to Omniture for track product views.
    It may be possible to use the code s.products=";"  + _satellite.getVar("ProductID1,")+";"  + _satellite.getVar("ProductID2,")+";"  + _satellite.getVar("ProductID3"); but I'm sure this is not the correct way of doing it. What if there are 5 products on page, or 50 products? How can I track all listed products in DTM?

 

Kind Regards
J