Google consent mode and page views


We are trying to implement Google Consent Mode on our discourse forum. It ‘kinda’ works, we have disabled Google Analytics from the settings and instead changed the theme to include gtag.js manually and call the various gtag consent related calls in the expected order.

However how do we make sure that a pageview is recorded every time the user clicks on a post / topic etc? Is there an event we can subscribe to in the theme js where we can send a pageview on each page change?

Push custom events to Google Tag Manager and Analytics documents how to hook to many events to trigger functions.

1 Like

Thanks I saw that page but that is using the Google tag manager. Is there an app event for a page change that I can use instead ? I see events for post created etc in that page but not page view or post view etc.

OK I think I fixed the issue. I installed a custom theme component and in the head I subscribed to the page:changed event which I found by grep’ing the source code.

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