Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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})
like image 470
dorachan2010 Avatar asked Nov 30 '17 20:11

dorachan2010


People also ask

Is GTAG and GTM the same?

The main differences are that Gtag. js requires adding code to the source to track new events or new platforms, whereas GTM doesn't.

Can I use both GTAG and GTM?

Having both hardcoded Google Analytics and Google Tag Manager on your site in and of themselves is not an issue. You'll ultimately need to make sure you're not duplicating your efforts and consequently duplicating your data. If you need to have both, then yes, you can.

Do I need both GTAG and GTM?

Google Ads and Google Marketing Platform tags are fully supported by Tag Manager, and there is no need to deploy additional gtag. js-based code on your site if Tag Manager is already in use.

What is the difference between GTAG js and analytics js?

Unlike analytics. js, gtag. js doesn't use trackers to send data to Google Analytics. It sends data to Google Analytics properties identified by their IDs set by the config command.


1 Answers

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.

like image 152
Eike Pierstorff Avatar answered Sep 28 '22 02:09

Eike Pierstorff