2

I am managing a very simple single page site, and my client wants to start a Google Ads campaign for it. I had added some days ago the Google Analytics tracking code to the page:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-XXXXXXXXXX');
</script>
//G-XXXXXXXXX is my Analytics code

(I am not using Google Tag Manager because it's a quite simple site, I know how to edit HTML by hand, and we're not planning on using any more tags).

Now, today I started setting up the Ads campaign, and it recommended that I add an Ads conversion tracking code for the event we're after (page views). The code it showed me was this:

<!-- Global site tag (gtag.js) - Google Ads: YYYYYYYYY -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-YYYYYYYYY"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'AW-YYYYYYYY');
</script>
// YYYYYYYY is my Ads account code, I suppose

Don't they look pretty much the same, except for the ID numbers? So which code should I add and in what order? Both, neither, one or the other?


EDIT: did the above, but now I have a slight problem (which I don't even know if it's really a problem), which is that the "Website traffic" default event created in Ads appears as non-verified, and doesn't register conversions. See screen cap:

Screencap

2

You can merge the two. Just add the config line of the Google Ads tag after the config line of the GA tag.

This is one of the benefits of the gtag system. You can track multiple accounts with the one tag.

11
  • Just a question: is this valid for Google Analytics 4 too? I'm asking because I set it up as advised days ago, and yet I have no conversions listed, so I don't know if I'm doing something wrong. – PaulJ Mar 18 at 10:46
  • 1
    Yes. Just add its config line to the existing tag. A basic tag will not track conversions, you have to add a purchase event or set up other events as conversions. – Tony McCreath Mar 19 at 9:40
  • Thanks for your answer. And what if my conversion event is just a page view? (I just want people to see my website). Do I leave the code just as is? – PaulJ Mar 19 at 9:54
  • How have you implemented the conversion? – Tony McCreath Mar 19 at 20:25
  • 1
    That looks like a website conversion that requires a special tag on the pages that will trigger that conversion. The name "Website traffic" is confusing. What actual conversion do you want to track with it? Just visiting the website is not a good conversion. If it worked, it would mean everyone converts. – Tony McCreath Mar 22 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.