Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

Question about Google Tag Manager and enhanced ecommerce

Assuming that I need to send some dataLayer info to Google Tag Manager, I will need this:

dataLayer.push({
  'ecommerce': {
    'currencyCode': 'EUR',                       // Local currency is optional.
    'impressions': [
     {
       'name': 'Triblend Android T-Shirt',       // Name or ID is required.
       'id': '12345',
       'price': '15.25',
       'brand': 'Google',
       'category': 'Apparel',
       'variant': 'Gray',
       'list': 'Search Results',
       'position': 1
     },
     {
       'name': 'Donut Friday Scented T-Shirt',
       'id': '67890',
       'price': '33.75',
       'brand': 'Google',
       'category': 'Apparel',
       'variant': 'Black',
       'list': 'Search Results',
       'position': 2
     }]
  }
});

The question is: do I need to manually write the JSON into my page or the gtm will do this for me after inserting the gtm tracking code into my page?

After searching some tutorials online, all the helpful info I found was how to configure the TagManager account but nobody talks about how the script is generated.

question from:https://stackoverflow.com/questions/65933006/question-about-google-tag-manager-and-enhanced-ecommerce

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You have to add the script in the page. It will not be generated automatically, but the parameter values ??will be recognized automatically It your GTM and GA configuration is right (I mean you don't have to create the variables in GTM but you have to create the ecommerce construct in the page with the values ??of your products).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...