XF 2.2 Trying to set up google analytics

Alvin63

Well-known member
I have a google ads account. A pop told me my website needed a google analytics tag. I followed the instructions in google analytics (it's the newer Analytics 4 which was the only option) and copied the code beginning with U into the box on SEO on Xenforo and saved. But the google ads page is still saying my website needs a google analytics tag. Now the U code was in brackets. I pasted it without the brackets. Do I need the brackets as well? Haven't a clue what I'm doing here - it's all new to me!
 
Ok I answered that one myself. Tried adding the brackets and got an Oops pop up telling me the format it needed to be in (without brackets). So it seems XF has it saved. So why is google ads still telling me I need a google analystics tag on my web page?

It says I'm using a Universal Analytics property and invites me to set up GA4 but from what I've read on here it's better to stick with Universal - is that right?
 
I followed the google instructions. Apparently the U number is just an ID and I need to paste the gtag.js as well. So I've pasted it under <head> in PAGE_CONTAINER. And saved. Ad page still says my website needs a google analytics tag.
 
(it's the newer Analytics 4 which was the only option) and copied the code beginning with U
As I did this just recently, it's not the one starting with U, but the one starting with G. You find it in Admin->Data Streams->Check your stream info, it should be web stream.

U was used before.

I think that Xenforo comes with everything needed.
 
Thanks. I now have google robots as visitors on the site so something must be working, but the google ads page still says your website needs a google analystics tag.

I don't have Data Streams under admin?

Code pasted is (I removed the UA number below). The UA number was the one I posted in Admin-options-SEO

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

gtag('config', 'UA-.................');
</script>
 
Actually if I click on the link on google ads with the message about your website needing a tag - it gives an either or option, not both. Either post the UA number or post the code. I've done both :rolleyes:. Initially I just posted the UA number and still had the message, so went back to the original instructions which said to post the code as well. Very confusing.
 
As I did this just recently, it's not the one starting with U, but the one starting with G. You find it in Admin->Data Streams->Check your stream info, it should be web stream.

U was used before.

I think that Xenforo comes with everything needed.

I'm on the Universal one not the new one - maybe that's why Data Stream doesn't show and it's a UA number
 
The message on my google ads page said option 1 paste the UA code it displayed into the analytic section of your web host or website builder. Or Option 2 - Install a tracking tag in your website code (and displays that).

I have done option 1 (and option 2 but now the code no longer seems to be in PAGE_CONTAINER). The message on google ads seems to have gone now so maybe it's working.

It is really not helpful of google to have two contradictory sets of instructions! The first set said to do both, the second set said one or the other! The first set said post it after <head>, the second set said post it before <head>. No idea what has happened to that code I posted but it doesn't seem to be there now.

Solution seems to be paste the UA code in SEO section and wait.
 
google's instructions are for general websites. most cms solutions have integrated support for google analytics. xenforo has the same. you just enter your analytics id in the form field you have already found in seo section. xenforo would automatically insert the code for analytics using that id.
 
Thank you. :) Which is what I did in the first place so maybe I was just a bit impatient when it didn't work straight away. I assume that is at the google end waiting for the message to get through!
 
it could be caching on your server that might have caused the delay. if it was a fresh site in analytics backend, i suppose google also takes some time to register hits on analytics.
 
Top Bottom