minimal-mistakes: Problem setting up Google Analytics

Hi, have recently launched a new release of our site using minimal-mistakes. All seems well, but I can’t get Google Analytics working…

Site is: www.tvrename.com GitHub repo is: https://github.com/TV-Rename/website

config.yml contains the following:

# Analytics
analytics:
  provider               : "google" # false (default), "google", "google-universal", "custom"
  google:
    tracking_id          :UA-110543541-1

The tracking ID worked on a previous incarnation of the site (using the leap-day theme)

I can’t for the life of me see what I’ve screwed up…

Any help much appreciated!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

A workaround might be to add the google analytics script into _includes/head/custom.html.

<script async src="https://www.googletagmanager.com/gtag/js?id=XXX-YOURID-XXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'XXX-YOURID-XXX);
</script>

My guess is you haven’t set Jekyll’s environment variable to production. By default it’s set to development and the theme only includes analytics tracking for production… much like comments.

You’ll want to set it to JEKYLL_ENV=production

ref: https://mmistakes.github.io/minimal-mistakes/docs/configuration/#analytics