swup / ga-plugin

A swup plugin for integrating Google Analytics 📈
https://swup.js.org/plugins/google-analytics-plugin
MIT License
2 stars 2 forks source link

Doesn't support new Global Site Tag (gtag.js) tracking #3

Closed studio-blueboat closed 4 years ago

studio-blueboat commented 4 years ago

The new recommended google analytics tracking code uses a different syntax.

We've update our site manually to run the following on transition complete:

gtag('config', '<TRACKING CODE>', {
    'page_title' : document.title,
    'page_path': window.location.pathname + window.location.search
});

I would suggest an update that checks for the presence of either configuration for backwards compatibility.

Do you accept PRs?

gmrchk commented 4 years ago

Hi, this has been already discussed once over here.

PR would be awesome.

ajmnz commented 4 years ago

I found this plugin from Joshua Hallee that seems to do the job. Would be nice to have it officially included in the GA Plugin.

gmrchk commented 4 years ago

Noice! I actually like that @joshuaHallee took the time to create the plugin. It's also nice it's specialized instead of having a bunch of IFs in it.
I will contact him about including the plugin in the swup docs or moving it under swup org. all together.

gmrchk commented 4 years ago

Unfortunately, no email listed, but I'm guessing @joshuaHallee doesn't mind since it's a public repo. Listed in docs.