Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Adobe DTM: Setting up 3rd Party Conversion tags

Avatar

Avatar
Validate 1
Level 1
pauld46525055
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
pauld46525055
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
pauld46525055
Level 1

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
Validate 10
Level 10
ParitMittal
Level 10

Likes

93 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

93 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
ParitMittal
Level 10

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
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,331 posts

Correct Reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,331 posts

Correct Reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile
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.