Manually initialize gtag.js for GDPR compliance
mainTo manage the loading of the Google tag script manually (e.g., waiting for user consent), set initMode: 'manual' in your module configuration. You can then use the initialize method from useGtag to inject the script into the document head.
If you need to initialize a specific Google tag ID that wasn't provided in the module options, you can pass it as an argument to initialize(id).
Tip: Although the method is SSR-safe, ensure you call it within a client-side context to ensure the script is actually loaded.
const { initialize } = useGtag()
// Call this after the user accepts your privacy policy
function acceptTracking() {
initialize()
}