My client has specifically requested the ability to track the staged pages separately from the production tracking in Google Tag Manager, using separate GTM containers. They do not want to have to change the Google Analytics JavaScript each time.
The ideal solution would be to maintain separate “Site Header HTML” for the staging domain but I am unable to connect the staging domain as a secondary domain. Every time I try, I get the following error: “This domain is already connected as a primary, secondary, redirect, or email sending domain.” However, the domain does not show up as any of those, including when I flip the “Display system domains” switch.
Is there anyway to maintain separate Site Header HTML for a staging domain? Is there another solution? There is no strict requirement for using the page staging functionality. They just need to be able to test new pages without having to manually change the tracking code.
I have around 5 years of coding experience, primarily working with Django web applications and Machine Learning engineering, including any devops needs.
I already searched the forum for a few different sets of keywords and read throught the following pages:
- Use code snippets with HubSpot content
- https://knowledge.hubspot.com/cos-general/add-your-google-analytics-code-to-your-hubspot-pages-or-blog?_ga=2.100588702.1638437897.1554681579-1350116256.1554681579&hubs_post=blog.hubspot.com/marketing/google-analytics&hubs_post-cta=HubSpot%20users%20can%20follow%20these%20simple%20instructions%20for%20adding%20GA
- Google Analytics: what It Costs, When To Use, How to Set Up
- Redesign and relaunch a site with content staging