MFR
MFR

Reputation: 2077

Google tag manager enhanced eCommerce

I am going to use Google tag manager for the first time and I have very basic question that I am struggling with. I have my code to insert to data layer. But the problem I do not see any place to insert my code. Sorry if the question is too stupid but this is what I see

enter image description here

Where can I put this code?

  // The GTM code.
 dataLayer.push({
"event": "addToCart",
"ecommerce": {
"currencyCode": "USD",
"add": {
  "products": [{
    "id": "57b9d",
    "name": "Kiosk T-Shirt",
    "price": "55.00",
    "brand": "Kiosk",
    "category": "T-Shirts",
    "variant": "red",
    "dimension1": "M",
    "quantity": 1
  }]
 }
}
});

Upvotes: 0

Views: 104

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

Usually the datalayer is not inserted via GTM, but is created within the page code. If you create it according to the specifications then the GTM tag will read it automatically without an special configuration, you'll have to make sure that "use datalayer" is enabled.

(In theory it is also possible to create a custom HTML tag and push the info to the datalayer via some custom javascript, or create a GTM variable of the type "Custom Javascript" and create a datalayer there. But there are few scenarios where this makes sense. The point of the datalayer is to get data from a backend system into your tags, and GTM does not know about your backend.)

Upvotes: 1

Related Questions