Open Erica-Ryan opened 5 years ago
I am having the same issue. Copied my tracking ID into the _config.yml but no tracking seems to occur.
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 :)
Worked for me! Maybe this should be added in the comment in the _config.yml
?
Worked for me as well! Looks like Google changed the tracking script, so the one included in academicpages no longer works...
This really works, thanks!
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.
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!
You just have to go a little further and it works fine. The following steps are needed:
provider: "custom"
in the _config.yml
file._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());
You just have to go a little further and it works fine. The following steps are needed:
- Set
provider: "custom"
in the_config.yml
file.- 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>
- From
_includes/scripts.html
, remove the line{% include analytics.html %}
.- In
_layouts/default.html
, add{% include analytics.html %}
right after the<head>
line.
Works perfect! Thank you so much!
You just have to go a little further and it works fine. The following steps are needed:
- Set
provider: "custom"
in the_config.yml
file.- 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>
- From
_includes/scripts.html
, remove the line{% include analytics.html %}
.- In
_layouts/default.html
, add{% include analytics.html %}
right after the<head>
line.
This is super helpful. Many thanks!
You just have to go a little further and it works fine. The following steps are needed:
- Set
provider: "custom"
in the_config.yml
file.- 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>
- From
_includes/scripts.html
, remove the line{% include analytics.html %}
.
- In
_layouts/default.html
, add{% include analytics.html %}
right after the<head>
line.
Fantastic! Thanks!
You just have to go a little further and it works fine. The following steps are needed:
- Set
provider: "custom"
in the_config.yml
file.- 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>
- From
_includes/scripts.html
, remove the line{% include analytics.html %}
.- In
_layouts/default.html
, add{% include analytics.html %}
right after the<head>
line.
Awesome. Thank you!
You just have to go a little further and it works fine. The following steps are needed:
- Set
provider: "custom"
in the_config.yml
file.- 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>
- From
_includes/scripts.html
, remove the line{% include analytics.html %}
.- In
_layouts/default.html
, add{% include analytics.html %}
right after the<head>
line.
Fantastic! Very simple and clear
You just have to go a little further and it works fine. The following steps are needed:
- Set
provider: "custom"
in the_config.yml
file.- 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>
- From
_includes/scripts.html
, remove the line{% include analytics.html %}
.- 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!
It looks like Google has updated analytics again so this might be more than just a documentation task. Since I don't use analytics on my own site, this might also be a good item for others to help out with.
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.