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

Update Google Analytics #100

Closed
wants to merge 1 commit into from
Closed

Update Google Analytics #100

wants to merge 1 commit into from

Conversation

pedrominicz
Copy link

Closes #88

@welcome
Copy link

welcome bot commented Feb 26, 2021

Welcome! Congrats on your first pull request to the Minimal theme. If you haven't already, please be sure to check out the contributing guidelines.

Copy link

@andresakata andresakata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the documentation, it's recommended to put the gtag.js into the <head>.

From the setup procedures:

Copy the global site tag into the section of your HTML.

@parkr
Copy link
Contributor

parkr commented Jul 28, 2021

Hi! You can now customize the Google Analytics code by using an include in your site: https://github.com/pages-themes/minimal#customizing-google-analytics-code

@parkr parkr closed this Jul 28, 2021
@Zenahr
Copy link

Zenahr commented Apr 17, 2022

@parkr Why is this closed? I just wasted around 20-30 minutes with this not being merged. The PR looks fine.

Can we replace head-custom-gogle-anlytics.html -->

{% if site.google_analytics %}
  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    ga('create', '{{ site.google_analytics }}', 'auto');
    ga('send', 'pageview');
  </script>
{% endif %}

with

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

As per Google's official recommendation?

This removes the need for users to manually create the file themselves and being a bit lost as to why GA isn't working.

@Zenahr
Copy link

Zenahr commented Apr 17, 2022

Hi! You can now customize the Google Analytics code by using an include in your site: https://github.com/pages-themes/minimal#customizing-google-analytics-code

This is cool but having the default be compatible with Google V4 would make more sense IMHO.

@shyamal-anadkat
Copy link

can we re-open this?

szorowi1 added a commit to nivlab/jspsych-demos that referenced this pull request Jan 18, 2023
szorowi1 added a commit to nivlab/jspsych-demos that referenced this pull request Jan 18, 2023
* add google analytics

* fix google analytics 
- pages-themes/minimal#245

* fix google analytics (pt 3)
- pages-themes/minimal#100
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

Successfully merging this pull request may close these issues.

Google Analytics
5 participants