Adobe DTM: Setting up 3rd Party Conversion tags

Avatar

Avatar

pauld46525055

Avatar

pauld46525055

pauld46525055

14-06-2017

I have been using various tag managers(Tealium & GTM) over the past 6 years. Recently, I've had a client that started using Adobe DTM. I am not a javascript programmer so this tool is far too technical for me.

The challenge I'm having is converting marketing vendors static code into workable code in DTM that will allow for the digitalData's array format when it comes to multiple products.

Are there any resources that show how to convert single product script into one that assesses an array and then provides values a, b, c & d for each instance of the array?

Example: i would want to be able to capture product ID, sku, quantity & price for each array item

digitalData.transaction.item[0]

digitalData.transaction.item[0].productID

digitalData.transaction.item[0].SKU

digitalData.transaction.item[0].quantity

digitalData.transaction.item[0].price

digitalData.transaction.item[1]

digitalData.transaction.item[1].productID

digitalData.transaction.item[1].SKU

digitalData.transaction.item[1].quantity

digitalData.transaction.item[1].price

Original marketing pixel code provided:

var trans = {

    orderid : 'ORDERID', /*not an array item */

    currency: 'CURRENCYCODE', /*not an array item */

    customerStatus: 'CUSTOMER_STATUS', /*not an array item */

    conversionType: 'Sale', /*not an array item */

    customerID: 'CUSTOMER_ID', /*not an array item */

    discountCode: 'DISCOUNT_CODE', /*not an array item */

    discountAmount: DISCOUNT_AMOUNT, /*not an array item */

    taxAmount: TAX_AMOUNT, /*not an array item */

    lineitems : [{

        quantity : QUANTITY_PURCHASED, /*found in array */

        unitPrice : SINGLE_UNIT_ITEM_PRICE, /*found in array */

        SKU: 'PRODUCT_SKU', /*found in array */

        productName: 'PRODUCT_NAME' /*found in array */

    }]

};

I know that all of the lineitem values will need to go through a conditional statement that looks for the value of the array and apply the 4 items, increment the array value and continue until there are no other array values. I just don't know how to program that since I don't know javascript

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

ParitMittal

Avatar

ParitMittal

ParitMittal

15-06-2017

Hi Paul ,

Assuming that the Jason structure is like below as per my understanding:

var trans = {

    orderid : 'ORDERID', /*not an array item */

    currency: 'CURRENCYCODE', /*not an array item */

    customerStatus: 'CUSTOMER_STATUS', /*not an array item */

    conversionType: 'Sale', /*not an array item */

    customerID: 'CUSTOMER_ID', /*not an array item */

    discountCode: 'DISCOUNT_CODE', /*not an array item */

    discountAmount: DISCOUNT_AMOUNT, /*not an array item */

    taxAmount: TAX_AMOUNT, /*not an array item */

    lineitems : [{

        quantity : QUANTITY_PURCHASED,

        unitPrice : SINGLE_UNIT_ITEM_PRICE,

        SKU: 'PRODUCT_SKU',

        productName: 'PRODUCT_NAME'

    },

{

        quantity : QUANTITY_PURCHASED,

        unitPrice : SINGLE_UNIT_ITEM_PRICE,

        SKU: 'PRODUCT_SKU',

        productName: 'PRODUCT_NAME'

    }

]

};

The javascript code would be like below:

   for (var i = 0; i < trans.lineitems.length; i++) {
var quantity = trans.lineitems[i].quantity;

var price = trans.lineitems[i].unitPrice;

var sku = trans.lineitems[i].SKU;

var productname = trans.lineitems[i].productName;
  alert
(quantity + ', ' + price + ', ' + sku +','+ productname);
  
}

Regards

Parit Mittal

Answers (1)

Answers (1)

Avatar

Avatar

jantzen_belliston-Adobe

Community Manager

Avatar

jantzen_belliston-Adobe

Community Manager

jantzen_belliston-Adobe
Community Manager

21-07-2017

Did Parit's reply help you to find a solution to your question? If so, I'd like to mark it correct.