GA4 Property: Only Track Specific Paths / Pages

42 views Asked by At

We are running a website called Songshare.com and have our own GA4 tag configured via gtag.js to track page_views and clicks via Google Analytics. We now want to allow artists / labels to provide their own Measurement ID in order for them to also track views and clicks of the relevant pages associated with their profile / songs via their own Google Analytics dashboard.

Adding the additional Measurement ID is no problem. We simply call gtag('config', 'G-XXXXXXXX'); with the additional ID and events are being tracked. However, we are now running into the problem that GA4 automatically tracks all page_views, history changes, and clicks, even when the user navigates away from paths / pages that are relevant to the profile that we added the additional Measurement ID for. This is no great, as we don't want the client to be able to track all of the paths and interactions users are doing outside of their relevant pages - so we really want to restrict the tracking to only the pages associated with their content.

We tried a couple of things, without luck:

  1. We tried to use analytics.js, as the old library does not auto-track history changes and clicks. However, it does not seem to be possible to use the old library with new GA4 properties as they don't have a UA-XXXXXX tracking ID. Also this would not be future-proof.

  2. We tried using the GA4 Measurement Protocol to manually send requests, however we need a Client ID that we can only obtain after initializing the config of the additional Measurement ID, and once initialized there is no way of preventing the other views / clicks from being tracked.

Ideally it would be great if we can unregister / uninitialize a given Measurement ID so that it is no longer tracked. Or alternatively provide some config parameter that disables all of the automatic tracking for a specific Measurement ID, and only tracks events that we manually and specifically send.

Any ideas how to solve this?

0

There are 0 answers