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

Google Analytics Verification Support #132

Open
zhenyuan0502 opened this issue Mar 31, 2021 · 2 comments
Open

Google Analytics Verification Support #132

zhenyuan0502 opened this issue Mar 31, 2021 · 2 comments

Comments

@zhenyuan0502
Copy link

Hi all,
I have reached the Google Analytics Verification for Ownership, which is using gtag.js, but I found out that the document required put it in <head> tag basically to verify.

So I request to move this part at script.ejs https://github.com/TriDiamond/hexo-theme-obsidian/blob/master/layout/_partial/scripts.ejs

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

and put them in head.ejs https://github.com/TriDiamond/hexo-theme-obsidian/blob/master/layout/_partial/head.ejs

Document: https://developers.google.com/analytics/devguides/collection/gtagjs/

@kcn3388
Copy link
Contributor

kcn3388 commented Jun 9, 2021

Actually, now all the scripts which mentioned in script.ejs will be add in the footer, and it seems no error now, move to header is not so necessary.

@zhenyuan0502
Copy link
Author

Actually, now all the scripts which mentioned in script.ejs will be add in the footer, and it seems no error now, move to header is not so necessary.

I am not sure if it's detected from Google, if it worked, feel free to close this issue

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