Open rcantin-w opened 2 weeks ago
Size Change: +4.69 kB (+0.48%)
Total Size: 982 kB
Filename | Size | Change | |
---|---|---|---|
content/webapp/.next/static/chunks/1187.3e587b771f4e596e.js |
0 B | -4.76 kB (removed) | đ |
content/webapp/.next/static/chunks/pages/_app-b5ae32e8b8f056a5.js |
0 B | -107 kB (removed) | đ |
content/webapp/.next/static/chunks/webpack-deff53f7207a7155.js |
0 B | -2.33 kB (removed) | đ |
identity/webapp/.next/static/chunks/pages/_app-faa942d597ee1057.js |
0 B | -100 kB (removed) | đ |
content/webapp/.next/static/chunks/1187.f663a3df326eed89.js |
4.76 kB | +4.76 kB (new file) | đ |
content/webapp/.next/static/chunks/pages/_app-d9d761e9126be844.js |
109 kB | +109 kB (new file) | đ |
content/webapp/.next/static/chunks/webpack-05726b4de9b0c06d.js |
2.33 kB | +2.33 kB (new file) | đ |
identity/webapp/.next/static/chunks/pages/_app-3a5813eaf8e42ea9.js |
103 kB | +103 kB (new file) | đ |
This method might not work best for Pixel tracking. We assume that stakeholders will want data sent from that first click/page view, and therefore it might sit better at the GTM level with a custom event trigger on consent change.
Are we not able to do the same thing in the codebase here on consent change? I thought the civic uk lib had a hook for that?
Are we not able to do the same thing in the codebase here on consent change? I thought the civic uk lib had a hook for that?
If you mean the onConsentChange
event, I tried to do it through the event listener and the state of the app, but I think the issue is that they're loaded in _document
which is SS only, which means (I think) it needs a full reload to change its contents, or we'd have to find the script in JS and manually add and remove it, which feels like a lot. To be honest this ticket has stretched a bit and it has been a while since I'd done that testing so happy to try again to check I understood the options correctly, which are the ones we discussed yesterday.
That's what we'd landed on with Segment in the past as well, that's the current behaviour for that script.
I think the onAccept
event in the CivicUk config gives us the opportunity to hook into this client side: https://github.com/wellcomecollection/wellcomecollection.org/blob/main/common/views/components/CivicUK/index.tsx#L146
edit: sorry, the event here is called analyticsConsentChanged
, can we not add an eventListener
for this?
edit, edit: we do - that's how the gtag is updated ... actually updating a component is what needs working out.
Who is this for?
10964
What is it doing for them?
_app
and out of_document
so we could change it based on client side changes and state.load: false
value (docs) to Segment script's options if consent has not been granted. The script doesn't disappear, but it's load function gets removed/not triggered by default.useEffect
, re-renders the script and its values (see above) should the state of the analytics consent change.onAccept
andonRevoke
fromanalyticsConsentChanged
toconsentChanged
, as we have marketing as well now. This was a miss from when we added a new category and made things confusing.trackPageview
useEffect's dependency array. Now, if someone toggles analytics consent on or off, or Accepts all cookies the first time they see the banner, if there are pageview values, the tracking gets triggered again.How to test
WC_analyticsDebug
to your cookies (value:true
), which will log events sent to Segment.pageview
set-up: http://localhost:3000/articles/ZWTLeBUAACgAVku2Risks
We've misunderstood something and it affects Segment events. So I suggest we merge early next week and keep a close eye.