Click here to Skip to main content
15,881,516 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am a newbie with GTM and I noticed there are tons of things to learn and setup in GTM. Things to take consideration regarding the environment I work in:

- I work with VB.NET, so every file I work with has a mark-up page (.aspx) and a codebehind (.aspx.vb)

My questions are the following:

1) I understand that, for eCommerce, the following Data Layer must be located in the .aspx page of my code:

<!-- DATA LAYER -->

<script>
dataLayer = [{
'transactionId': '1234',
'transactionAffiliation': 'Acme Clothing',
'transactionTotal': 38.26,
'transactionTax': 1.29,
'transactionShipping': 5,
'transactionProducts': [{
'sku': 'DD44',
'name': 'T-Shirt',
'category': 'Apparel',
'price': 11.99,
'quantity': 1
}]
}];
</script>
<!-- END OF DATA LAYER -->

<!--- GOOGLE TAG MANAGER CODE GOES BELOW DATA LAYER AFTER BEGINNING OF BODY TAG -->
GTM CODE GOES HERE
<!--- END OF GTM CODE -->

I understand that the variables such as 'Acme Clothing', 'T-Shirt', 'Apparel', etc. can be changed as well as the prices.

I also understand that the transactionProducts is basically an array of products.

How would I go about ADDING new products to the array? Is my data layer in the .aspx correctly setup?
How would I go about modifying this data layer from the vb.net (.aspx.vb) code behind?

I am really confused about this as I cannot find any examples online.

Any help will be appreciated.

Thank you
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900