Optimizing cookie domains and cleaning Google Tag Manager for a streamlined umn.edu experience
Have you ever received the "431: Request Header Fields Too Large" error? At the heart of this issue is the domain level at which cookies are set. This situation arises when a cookie set by a subdomain, such as a.umn.edu, inadvertently gets included in every request to other umn.edu subdomains.
This collective accumulation of cookies can escalate quickly, resulting in an overly large request header. When a user's browser sends this bloated request to a server, it often leads to a server's refusal to respond, manifesting as the aforementioned 431 error.
While we can’t control every cookie set at every subdomain, there are ways we can help mitigate the 431 error using Google Tag Manager (GTM) and, at the same time, keep your GTM container clean and free of clutter.
All it takes are a couple housekeeping steps that not only ensure we are not overloading the umn.edu environment, but will also help eliminate old noisy tags, keep your Google Analytics (GA) account domain correctly targeted, and guarantee you use only tags associated with GA4.
Time For Some Pixels Winter Cleaning
Remember that one agency you worked with back in 2020? I sure don’t. But after all of the creative was placed, channels were identified, and results were reported back, chances are they never removed all of those fun social and retargeting pixels from your GTM account.
Do you have a three-year-old Facebook pixel still lingering in your property? Believe it or not, it’s probably still firing on the umn.edu domain. Moreover, all of these old pixels are creating noise in your account, making it more difficult for your team to identify what tags are important right now.
The good news is that these are easy to remove! All you need to do is log into your GTM account. In the left rail navigation, go to your tags. Once there, you’ll see to the far right a column titled “Last Edited”. This is where you can identify the last active edit date of your tags. See a tag last edited before a global pandemic? That’s a good identifier the tag needs review.
If it’s not being used, then simply click the square box left of the tag name. Then navigate to the trash can icon in the top right and delete it. All done! You’ve effectively created less noise for your GTM container.
UA to GA4 Migration: Don’t Forget to Remove Legacy Tags!
It's time to put wonderful Universal Analytics to rest. Yeah, I know, I miss it too. Most GTM accounts I come across still have the Universal Analytics tag still firing on websites. These do need to be removed.
Setting Your Gtag Cookie Domain: The Big Opportunity
This is one of the bigger 431 error issues we’ve identified. As noted in the introduction, our website domain is set up with a series of subdomains with the MAIN domain set as umn.edu.
This means, without the cookie properly configured to your specific unit’s subdomain, all GA accounts are set at the umn.edu domain instead of being correctly targeted to the www.xxxxx.umn.edu subdomain.
For example, if the cookie domains were not set for twin-cities.umn.edu and morris.umn.edu then both GA cookies would fire on the umn.edu domain. You can see, with so many subdomains across our digital ecosystem, these cookies can blow up quickly.
Follow these simple steps to target your unit’s subdomain in GTM:
- Access GA4 gtag Tag: Go to your GTM account and navigate to your GA4 gtag Tag. The tag title naming convention may vary across units, but it should be a “gtag” that fires on either “pageview” or "Initialize on pageview”.
- Add Configuration Parameter: Under “Configuration Settings”, look for a button labeled “Add A Parameter” and click on it.
- Enter Configuration Details: Two new fields will appear—“Configuration Parameter” on the right and “Value” on the left.
- In the “Configuration Parameter” field, type in “cookie_domain”. This is the Google parameter identifier.
- In the “Value” field, enter your main subdomain along with the umn.edu domain. For example, for Duluth’s main URL, https://www.d.umn.edu/, the subdomain is “d” and the main domain is umn.edu. Hence, the “Value” would be “d.umn.edu”.
- Save and Publish: Once you have entered the correct information, hit Save and then Publish your GTM container.
And that’s it! You’ve now targeted your specific subdomain for GTM and Google Analytics.
Conclusion
By cleaning out outdated pixels, removing old Universal Analytics tags, and accurately targeting your unit’s subdomain, you ensure a more efficient and user-friendly experience on our umn.edu site. Additionally, these steps help maintain a streamlined GTM property.
If you have any questions or need help with any of the above, don’t worry! The Measurement and Analytics team has your back. Feel free to reach out to me, Eric Meyer, at meye3817@umn.edu for a quick consultation and help. Moreover, we’d love to hear from you in general! Always reach out and say hi. Happy analyzing!