dorachan2010
dorachan2010

Reputation: 1091

Are gtag.js and gtm.js interchangeable?

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})

Upvotes: 7

Views: 4585

Answers (2)

Pat Grady
Pat Grady

Reputation: 307

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 accomplish 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".

Upvotes: 1

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

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.

Upvotes: 5

Related Questions