so-simple-theme icon indicating copy to clipboard operation
so-simple-theme copied to clipboard

Google analytics now has two different styles of tracking codes that require different javascript.

Open mikebowler opened this issue 3 years ago • 6 comments

Google analytics now has two different kinds of tracking ids. The old Universal Analytics style starts with "UA-" and works properly with what's already checked in. The new Google Analytics 4 style starts with "G-" and requires the new Javascript below.

Note that I was going to submit a pull request but couldn't figure out why the analytics code was in two different places and what the interactions were. It's in both scripts.html and google-analytics.html

mikebowler avatar May 29 '21 15:05 mikebowler

This issue has been automatically marked as stale because it has not had recent activity.

If this is a bug and you can still reproduce this error on the master branch, please reply with any additional information you have about it in order to keep the issue open.

If this is a feature request, please add as an Idea under discussions and elaborate on why it is core to this project and why you feel more than 80% of users would find it beneficial.

This issue will automatically be closed in 7 days if no further activity occurs. Thank you for all your contributions.

github-actions[bot] avatar Jul 29 '21 02:07 github-actions[bot]

From reading the code, I believe the google-analytics.html include is currently completely unused. It was probably meant to be used in scripts.html. So I think a PR fixing that (including google-analytics.html in scripts.html) and then upgrading google-analytics.html would be ideal :+1: .

olifre avatar Jul 30 '21 01:07 olifre

I've submitted a PR to address this one. https://github.com/mmistakes/so-simple-theme/pull/429

mikebowler avatar Jul 30 '21 18:07 mikebowler

Hi, any chance @mikebowler's PR could be merged?

Is there any other workaround?

channingwalton avatar Jul 20 '22 21:07 channingwalton

I'm also interested in seeing this get merged.

pymander avatar Oct 03 '22 21:10 pymander

Thank you so much @mikebowler, I've applied this manually to my site, I couldn't figure out why my update in google-analytics.html wasn't working.

danielle-h avatar Feb 07 '24 14:02 danielle-h