Open csBlackWolf opened 4 years ago
Thanks for the report!
Could you confirm where the code is inserted on your page? It should be inserted in the head
already.
Is the "homepage" described by Google actually a Flarum page or is it maybe another website (for example if Flarum is in a subfolder)?
The code seems to be in the head
.
It looks like this:
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-000000000-0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
</script>
Google say it should look like this:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-000000000-0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-000000000-0');
</script>
I am not sure that could be the problem, but google mentions that it is important, to have the exact same code. https://support.google.com/webmasters/answer/9008080#google_analytics_verification
I also think I have read that it would be better to insert the script before any other script and the CSS.
My Flarum is still not recognized by Google Search Console. Any ideas?
It seems like we made the choice to only call the tracking code once the first page is rendered in the single page app https://github.com/FriendsOfFlarum/analytics/blob/fb91b7e05d99d1d489197362d5c09c1a5647bb13/js/src/forum/index.js#L7
That would be why it can't be used for Google verification.
I don't really know if we want to change that. Are you able to use another verification method?
I don't really know if we want to change that. Are you able to use another verification method?
That is the problem. For FreeFlarum, this was the only good way to verify for the google search console. The only other way would be to buy a domain, make a subdomain and set it via CNAME to my FreeFlarum Domain. Then i could use the domain verification. However, this is a little inconvenient. :(
You mean it worked on Flarum beta 13?
The code that seems to be at the origin of the problem hasn't been changed in the last 2 years :sweat_smile:
I think i can remember that it have worked in the past... I am almost sure about it. I was thinking that google has changed something how it detects analytics. 😮
I think it would be great if the Google Analytics code could be recognized by the Google Search Console to confirm the ownership of the website.
When I try to verify my ownership through Analytics, I get the following error:
Would it be possible to make it compatible?
PS: The Google Tag Manager code is also not recognized by the Google Search Console.