Last active
January 8, 2025 21:42
-
-
Save seanhamlin/486497142097c0dc403135953024c73b to your computer and use it in GitHub Desktop.
Strip analytics (Google, Facebook etc) query parameters in Fastly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Query string stripping for web analytics and attack query parameters. | |
# | |
# Currently stripped query parameteres include: | |
# - Google Analytics | |
# - Google Adwords (Doubleclick) | |
# - TikTok | |
# - Wordfence security | |
# | |
# @see https://developers.google.com/tag-platform/devguides/consent#added_parameters | |
# @see https://ads.tiktok.com/help/article/tiktok-click-id?lang=en | |
set req.http.X-Original-Url = req.url; | |
set req.url = querystring.globfilter(req.url, "utm_*"); | |
set req.url = querystring.filter(req.url, | |
"fbclid" + querystring.filtersep() + | |
"dclid" + querystring.filtersep() + | |
"gclid" + querystring.filtersep() + | |
"ttclid" + querystring.filtersep() + | |
"wbraid" + querystring.filtersep() + | |
"_ga" + querystring.filtersep() + | |
"_gl" + querystring.filtersep() + | |
"wordfence_syncAttackData" + querystring.filtersep() + | |
"gclsrc"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment