admin管理员组

文章数量:1335840

Hi I'm new to Google Tag Manager,

I am trying to add Google Adwords Conversion Pixel to our website, and google tells me I should add the following snippet.

  gtag('event', 'conversion', {
      'send_to': 'AW-1000000/XXXXXXXX',
      'event_callback': callback
  });

Since our website is already using gtm.js,

can I convert the above snippet to the following to get the same effect?

dataLayer.push({ "event": "conversion", 
"send_to": "AW-1000000/XXXXXXXX", "event_callback": undefined})

Hi I'm new to Google Tag Manager,

I am trying to add Google Adwords Conversion Pixel to our website, and google tells me I should add the following snippet.

  gtag('event', 'conversion', {
      'send_to': 'AW-1000000/XXXXXXXX',
      'event_callback': callback
  });

Since our website is already using gtm.js,

can I convert the above snippet to the following to get the same effect?

dataLayer.push({ "event": "conversion", 
"send_to": "AW-1000000/XXXXXXXX", "event_callback": undefined})
Share Improve this question edited Sep 17, 2020 at 10:36 yodabar 4,7993 gold badges35 silver badges39 bronze badges asked Nov 30, 2017 at 20:34 dorachan2010dorachan2010 1,0913 gold badges14 silver badges21 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

No. But you can create an Adwords conversion tag within GTM (there is a template for this, the part before the slash is the conversion id, the part after the slash the conversion label). If you want you can configure the tag via the dataLayer, but you'd still have to create a tag within GTM and apply a trigger to make this work.

Gtag.js is great for sites that don't use tag management systems. If you use GTM, then use GTM triggers and tag templates for adwords to acplish your measurement needs.

Gtag.js will be the library that replaces analytics.js, and thus replace the ga('send') type of measurement code. You have likely replaced that syntax with the GTM GA tag templates and triggers like "All Pages".

本文标签: javascriptAre gtagjs and gtmjs interchangeableStack Overflow