The UBC.ca Cookie Cleaner is a lightweight web utility designed to help restore normal access to UBC websites affected by oversized or conflicting cookies. Some analytics and tracking tools across UBC subdomains have been configured inconsistently, occasionally causing browsers to return “Request Header Fields Too Large.”
👉 Try it here: https://clf.ubc.ca/cookie-cleaner.html
This tool provides an easy, temporary way to remove UBC-related cookies until a unified governance model for analytics and cookie management is in place.
To prevent your site from crashing other UBC websites, you must ensure your tracking cookies are scoped only to your subdomain. Following these steps stops the accumulation of headers at the root level.
If you use GTM to deploy GA4, you must override the default "auto" cookie domain:
- Open your GA4 Configuration Tag.
- Under Fields to Set, add a new row:
- Field Name:
cookie_domain - Value: Your specific subdomain (e.g.,
science.ubc.ca)
- Field Name:
- Do not leave this blank or set to
auto.
If you hardcode your tracking script, update your configuration line:
// ✅ CORRECT: Scoped to your specific site
gtag('config', 'G-XXXXXXXXXX', {
'cookie_domain': 'your-subdomain.ubc.ca'
});
// ❌ INCORRECT: Causes "Cookie Bloat" across ubc.ca
gtag('config', 'G-XXXXXXXXXX'); 👉 Official Documentation: https://developers.google.com/tag-platform/security/guides/customize-cookies
When tracking cookies (e.g., Google Analytics, Meta Pixel, TikTok Pixel, Hotjar, or Clarity) are set at the root ubc.ca domain rather than at their specific subdomain, they are shared across multiple UBC sites. This leads to:
- Oversized HTTP request headers
- Browser errors and failed requests
- Slower performance or inconsistent user sessions
The cleaner helps reset these cookies so affected pages can load normally again.
-
Lists cookies associated with
ubc.caand its subdomains -
Explains the common tracking cookies and their function
-
Allows users to:
- Delete individual cookies
- Delete all UBC-related cookies at once
The script specifically targets:
.ubc.ca
You can use the cookie cleaner in one of two ways, depending on your site setup.
- Download the provided
cleaner.htmlfile. - Upload it to any website that has a
*.ubc.cadomain (for example,brand.ubc.caorevents.ubc.ca). - Visit the page in your browser (e.g.,
https://brand.ubc.ca/cleaner.html). - Click “Delete All UBC Cookies” or remove specific cookies individually.
- Refresh the affected UBC site to confirm the issue is resolved.
If you prefer not to host a separate page:
- Copy the JavaScript from the
<script>section incleaner.html. - Add it to a temporary utility page or admin-only area within your UBC-hosted site (
*.ubc.ca). - Ensure it runs in a browser context under a UBC domain so it can access the relevant cookies.
You should see:
There is no cookie 🍪 left.
In some cases, the cookie cleaner page may not load because the browser is already sending too many cookies with the request header. When this happens, you can try using a minimal cookie reset script that removes UBC-related cookies before loading the full tool.
You can access the reset script in two ways:
The reset script attempts to remove cookies associated with:
.ubc.ca
After running the reset script:
- Try accessing the affected UBC site again.
- If the site loads successfully, you can then use the UBC Cookie Cleaner to review or remove any remaining cookies.
If the error persists and the reset script cannot run, you may need to manually clear cookies for ubc.ca in your browser settings.
This should only be necessary in rare cases where the browser refuses requests before any page content or scripts can load.
Author: UBC Communications Copyright: © 2025 The University of British Columbia More Info: https://brand.ubc.ca/clf