- Issue created by @mbenfield
- πΊπΈUnited States mbenfield
FYI, the GA code was in the theme's js document ready function. I removed it and used the google_tag module. No more double pageviews.
- πΊπΈUnited States mbenfield
I was able to create a regex in the cache url exclusion to stop the double pageviews
- π©πͺGermany Anybody Porta Westfalica
Thanks @mbenfield, could you perhaps share your solution with the community?
I guess this is by design and the way you're embedding the GA code. Don't see a general issue or something we could fix here, but leaving this open for others to have a look.
- πΊπΈUnited States sleewok
Not sure if this is related... I just installed this module and noticed that gtag.js is being fetched twice now. In fact, all my external resources are being fetched twice. The initiator is service-worker-data.
I am using the googletag module with advagg.
- π©πͺGermany Anybody Porta Westfalica
Thanks, so we need to find out, if there's a general solution for this and if this is a general PWA problem or a problem of this module's implementation!
- π©πͺGermany Anybody Porta Westfalica
Found some related things, so this kind of a service worker issue, but we have to find a solution here in the module:
- https://stackoverflow.com/questions/54225136/excluding-analytics-js-and-...
- https://stackoverflow.com/questions/45663796/setting-service-worker-to-e...
- https://github.com/hanford/next-offline/issues/224
Of course we could start a blacklist, but that will be a never ending story.
So I think we should instead try to only load current URL sources by default? If anyone wants to change that, it's his job to do so.But of course that approach might also not be that easy, for example if there are absolute URLs vs. relative etc.
If anyone needs a quick solution, add the external scripts to the service worker blacklist.
How to solve this best, @Grevil?
- Assigned to Grevil
- π©πͺGermany Grevil
I'll take a look, after I resolved the other issues! π
- Issue was unassigned.
- Status changed to Postponed
over 1 year ago 7:54am 13 September 2023 - π©πͺGermany Anybody Porta Westfalica
Let's postpone this on π [META][pwa_service_worker] Refactor 'pwa_service_worker' implementations and flaws Needs work
Who runs into this should consider disabling the service worker for now.
- πΊπΈUnited States mbenfield
To stop double pageviews in GA and in parse.ly, I added to service worker configuration, URLs to exclude:
.*parse\.ly.*
.*parsely\.com.*
.*google-analytics.*
.*googletag.*