Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Google Search Console verification #26

Open
csBlackWolf opened this issue Aug 10, 2020 · 7 comments
Open

Compatibility with Google Search Console verification #26

csBlackWolf opened this issue Aug 10, 2020 · 7 comments

Comments

@csBlackWolf
Copy link

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:

Verification method:
Google Analytics

Failure reason:
The Google Analytics tracking code on your site is in the wrong location on the page. You can verify site ownership with the tracking snippet placed in the <head> section of your home page.
Learn more: https://support.google.com/analytics/answer/174090

Please fix your implementation and reverify, or use another verification method.
Learn more: https://support.google.com/webmasters/answer/9008080#google_analytics_verification

Would it be possible to make it compatible?

PS: The Google Tag Manager code is also not recognized by the Google Search Console.

@clarkwinkelmann
Copy link
Member

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

@csBlackWolf
Copy link
Author

csBlackWolf commented Aug 17, 2020

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.

@csBlackWolf
Copy link
Author

csBlackWolf commented Nov 14, 2020

My Flarum is still not recognized by Google Search Console. Any ideas?

grafik
grafik
grafik

@clarkwinkelmann
Copy link
Member

It seems like we made the choice to only call the tracking code once the first page is rendered in the single page app

gtag('config', app.data.googleTrackingCode, {

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?

@csBlackWolf
Copy link
Author

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. :(

@clarkwinkelmann
Copy link
Member

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 😅

@csBlackWolf
Copy link
Author

csBlackWolf commented Nov 18, 2020

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. 😮

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants