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

Struggling to get google analytics to work #265

Open
Erica-Ryan opened this issue Sep 1, 2019 · 14 comments
Open

Struggling to get google analytics to work #265

Erica-Ryan opened this issue Sep 1, 2019 · 14 comments
Labels
documentation Changes to documentation only (e.g., README, Guide, Wiki Pages, etc.)
Milestone

Comments

@Erica-Ryan
Copy link

I added my tracking ID to the config, in double quotes. However, google analytics is not logging any hits even though I'm testing it.

I've looked at other documentation and I know the code google analytics is providing me is different from the google_universal.html file. But I'm not sure if that means it has actually changed or if they do the same thing and I just don't understand them. I also saw on other guides that my Jekyll environment should be production? I'm not sure sure what that means for this repo.

@MatisPatel
Copy link

I am having the same issue. Copied my tracking ID into the _config.yml but no tracking seems to occur.

@Linear95
Copy link

Hi, I came up with the same issue, but solved it by first change provider of analytics to "custom" in _config.yml, then directly copy your google analytics tracking code to _includes/analytics-providers/custom.html. Hope this can help :)

@JulianKlug
Copy link

JulianKlug commented Oct 28, 2020

Worked for me! Maybe this should be added in the comment in the _config.yml?

@pantonik
Copy link

Worked for me as well! Looks like Google changed the tracking script, so the one included in academicpages no longer works...

STaisiya pushed a commit to STaisiya/staisiya.github.io that referenced this issue Mar 25, 2021
@rogerioagjr
Copy link

This really works, thanks!

yunjunz added a commit to yunjunz/yunjunz.github.io that referenced this issue Jan 18, 2022
manideepabc added a commit to manideepabc/manideepabc.github.io that referenced this issue Sep 5, 2022
@saideepesh
Copy link

saideepesh commented Sep 13, 2022

Has Google Analytics stopped working for anyone else? It worked just fine with the 'custom' solution mentioned above, however, it stopped working since a month now.

@ozlemtuncel
Copy link

I have the same issue and custom solution does not work. As of January 2023, universal analytics tracking code will not work and switching to google analytics 4 is necessary. I have tried different things (like this stackoverflow answers) but could not figure it out!

@tnybny
Copy link

tnybny commented Feb 7, 2023

You just have to go a little further and it works fine. The following steps are needed:

  1. Set provider: "custom" in the _config.yml file.
  2. add your website's google tag script that you're given when you sign up for analytics 4 to _includes/analytics-providers/custom.html. It looks something like
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());


<!-- end custom analytics snippet -->	  gtag('config', YOUR_TAG');
</script>
  1. From _includes/scripts.html, remove the line {% include analytics.html %}.
  2. In _layouts/default.html, add {% include analytics.html %} right after the <head> line.

@ozlemtuncel
Copy link

You just have to go a little further and it works fine. The following steps are needed:

  1. Set provider: "custom" in the _config.yml file.
  2. add your website's google tag script that you're given when you sign up for analytics 4 to _includes/analytics-providers/custom.html. It looks something like
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());


<!-- end custom analytics snippet -->	  gtag('config', YOUR_TAG');
</script>
  1. From _includes/scripts.html, remove the line {% include analytics.html %}.
  2. In _layouts/default.html, add {% include analytics.html %} right after the <head> line.

Works perfect! Thank you so much!

DTSchroeder added a commit to DTSchroeder/DTSchroeder.github.io that referenced this issue Apr 8, 2023
@viniciuspr88
Copy link

You just have to go a little further and it works fine. The following steps are needed:

  1. Set provider: "custom" in the _config.yml file.
  2. add your website's google tag script that you're given when you sign up for analytics 4 to _includes/analytics-providers/custom.html. It looks something like
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());


<!-- end custom analytics snippet -->	  gtag('config', YOUR_TAG');
</script>
  1. From _includes/scripts.html, remove the line {% include analytics.html %}.
  2. In _layouts/default.html, add {% include analytics.html %} right after the <head> line.

This is super helpful. Many thanks!

@jaywt
Copy link

jaywt commented May 25, 2023

You just have to go a little further and it works fine. The following steps are needed:

  1. Set provider: "custom" in the _config.yml file.
  2. add your website's google tag script that you're given when you sign up for analytics 4 to _includes/analytics-providers/custom.html. It looks something like
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());


<!-- end custom analytics snippet -->	  gtag('config', YOUR_TAG');
</script>
  1. From _includes/scripts.html, remove the line {% include analytics.html %}.
  2. In _layouts/default.html, add {% include analytics.html %} right after the <head> line.

Fantastic! Thanks!

@ZijingWu381
Copy link

You just have to go a little further and it works fine. The following steps are needed:

  1. Set provider: "custom" in the _config.yml file.
  2. add your website's google tag script that you're given when you sign up for analytics 4 to _includes/analytics-providers/custom.html. It looks something like
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());


<!-- end custom analytics snippet -->	  gtag('config', YOUR_TAG');
</script>
  1. From _includes/scripts.html, remove the line {% include analytics.html %}.
  2. In _layouts/default.html, add {% include analytics.html %} right after the <head> line.

Awesome. Thank you!

@yxwu1999
Copy link

You just have to go a little further and it works fine. The following steps are needed:

  1. Set provider: "custom" in the _config.yml file.
  2. add your website's google tag script that you're given when you sign up for analytics 4 to _includes/analytics-providers/custom.html. It looks something like
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());


<!-- end custom analytics snippet -->	  gtag('config', YOUR_TAG');
</script>
  1. From _includes/scripts.html, remove the line {% include analytics.html %}.
  2. In _layouts/default.html, add {% include analytics.html %} right after the <head> line.

Fantastic! Very simple and clear

@viniciuspr88
Copy link

You just have to go a little further and it works fine. The following steps are needed:

  1. Set provider: "custom" in the _config.yml file.
  2. add your website's google tag script that you're given when you sign up for analytics 4 to _includes/analytics-providers/custom.html. It looks something like
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());


<!-- end custom analytics snippet -->	  gtag('config', YOUR_TAG');
</script>
  1. From _includes/scripts.html, remove the line {% include analytics.html %}.
  2. In _layouts/default.html, add {% include analytics.html %} right after the <head> line.

Hi everyone, I followed the steps outlined by @tnybny a couple of months ago and it worked beautifully. But my Google Analytics dashboard now says it stopped collecting data and I cannot seem to find a way to fix it. Anyone had the same issue and could advise? Many thanks!

mijtsma added a commit to mijtsma/mijtsma.github.io that referenced this issue Sep 1, 2023
Followed these instructions academicpages#265
michael-swift added a commit to michael-swift/michael-swift.github.io that referenced this issue Dec 14, 2023
boyiwei added a commit to boyiwei/boyiwei.github.io that referenced this issue Feb 10, 2024
@rjzupkoii rjzupkoii modified the milestones: v0.9, 2024 Refresh Feb 14, 2024
@rjzupkoii rjzupkoii added documentation Changes to documentation only (e.g., README, Guide, Wiki Pages, etc.) and removed enhancement An enhancement. labels Feb 17, 2024
@rjzupkoii rjzupkoii modified the milestones: 2024 Refresh, Documentation Feb 17, 2024
fliphilipp added a commit to fliphilipp/fliphilipp.github.io that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes to documentation only (e.g., README, Guide, Wiki Pages, etc.)
Projects
None yet
Development

No branches or pull requests