_internal GA template: not working with the new gtags.js


Just looking for some clarification.

I have been getting some email from google lately about new tags for analytics.

By updating your current Google Analytics tag (analytics.js) to the latest tag (gtag.js), you will benefit from:*

I raised an issue to ask about this to the developers of the theme I use.

Their response was
We use the Hugo tag, so that would be answered there.

I am not sure that it’s a Hugo issue. Wouldn’t it be something that the theme creator needs to take care of. Provide the new gtags.js

Anyone have any thoughts? I am trying to workout how and if I should make the change.

Looking around and it looks like this is tied to the internal templates. I have raised an issue with Hugo on GitHub.

You opened a duplicate issue as I have pointed out on GitHub.

Currently the internal templates can be overridden in individual projects, the forum has posts about overriding internal tempates, please use the forum search functionality.

Which theme are you using?

To answer your question:
Yes. The theme author should provide an update to that code. Not the Hugo maintainer.

Especially since the status of the internal templates for 3rd party services is currently under review and may be removed from Hugo in a coming release (see: https://github.com/gohugoio/hugo/issues/7893).

Also someone has offered a workaround on GitHub that may interest you: https://github.com/gohugoio/hugo/issues/7954#issuecomment-736275767

I am using the ananke Theme.

I thought it might actually be the theme author.

Though I might start considering making a change.

Thanks for the response. :slight_smile:

Hugo provides the internal template for injecting google analytics.js script i.e. _internal/google_analytics_async.html. Most of the Hugo themes use the same internal template to enable google analytics.

What you can do is write your own partial and replace that with internal template. Here is step by step guide:-

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.