Skip to content

Cover self-hosted Google Tag Manager entries: "https://gtm.<domain>/gtm.js?id=GTM-..."#1069

Merged
philipp-classen merged 4 commits intomainfrom
cover_self_hosted_google_tag_manager_entries
Feb 25, 2026
Merged

Cover self-hosted Google Tag Manager entries: "https://gtm.<domain>/gtm.js?id=GTM-..."#1069
philipp-classen merged 4 commits intomainfrom
cover_self_hosted_google_tag_manager_entries

Conversation

@philipp-classen
Copy link
Member

Matches entries like:

Not sure how common the setup is; but if a domain has a subdomain gtm and serves from there /gtm.js?id=GTM-..., false-positives should be fairly unlikely.

@BrianClifton
Copy link
Collaborator

I would be tempted to classify this separately as "server-side GTM" or similar wording.

Its a growing enterprise configuration to avoid 3P script blocking by Safari et al.

Subdomains can literally be anything (e.g. my preferred choice is sgtm). Therefore my suggestion is to keep it simple and filter only on: /gtm.js

We have used this filter within our own app for approx 1 year and I have not found any issues.

@philipp-classen
Copy link
Member Author

I would be tempted to classify this separately as "server-side GTM" or similar wording.

Its a growing enterprise configuration to avoid 3P script blocking by Safari et al.

Subdomains can literally be anything (e.g. my preferred choice is sgtm). Therefore my suggestion is to keep it simple and filter only on: /gtm.js

We have used this filter within our own app for approx 1 year and I have not found any issues.

Removing the domain check makes sense to me. Do you know if it general enough to keep the prefix check (id=GTM-), or do IDs also tend to vary in those setup?

We could split the entries to distinguish between the traditional and the server-side setup. I think, we could express it to match on any domain except for googletagmanager.com and use that in a separate pattern.

@BrianClifton
Copy link
Collaborator

I would be tempted to classify this separately as "server-side GTM" or similar wording.
Its a growing enterprise configuration to avoid 3P script blocking by Safari et al.
Subdomains can literally be anything (e.g. my preferred choice is sgtm). Therefore my suggestion is to keep it simple and filter only on: /gtm.js
We have used this filter within our own app for approx 1 year and I have not found any issues.

Removing the domain check makes sense to me. Do you know if it general enough to keep the prefix check (id=GTM-), or do IDs also tend to vary in those setup?

We could split the entries to distinguish between the traditional and the server-side setup. I think, we could express it to match on any domain except for googletagmanager.com and use that in a separate pattern.

Within our app we did not include any query parameters in the filter.

I have not seen an id parameter with another prefix, but it is possible. For example, these types of client side requests are common: https://www.googletagmanager.com/gtag/js?id=AW-

@philipp-classen philipp-classen marked this pull request as draft February 24, 2026 11:04
@philipp-classen
Copy link
Member Author

I would be tempted to classify this separately as "server-side GTM" or similar wording.
Its a growing enterprise configuration to avoid 3P script blocking by Safari et al.
Subdomains can literally be anything (e.g. my preferred choice is sgtm). Therefore my suggestion is to keep it simple and filter only on: /gtm.js
We have used this filter within our own app for approx 1 year and I have not found any issues.

Removing the domain check makes sense to me. Do you know if it general enough to keep the prefix check (id=GTM-), or do IDs also tend to vary in those setup?
We could split the entries to distinguish between the traditional and the server-side setup. I think, we could express it to match on any domain except for googletagmanager.com and use that in a separate pattern.

Within our app we did not include any query parameters in the filter.

I have not seen an id parameter with another prefix, but it is possible. For example, these types of client side requests are common: https://www.googletagmanager.com/gtag/js?id=AW-

Thanks for the information. I think, we can start with including the "id=" matching for the start to avoid false-positives. And then either extend it to more prefixes or even drop it.

Changing it to a draft now. Will later try out if the pattern can be split into the server-side version.

Commonly used for server-side tagging.
@philipp-classen philipp-classen marked this pull request as ready for review February 24, 2026 18:27
@philipp-classen
Copy link
Member Author

Split it into a separate pattern now: "Server-side Google Tag Manager", which matches only first-party requests.

@philipp-classen philipp-classen merged commit d005a42 into main Feb 25, 2026
1 check passed
@philipp-classen philipp-classen deleted the cover_self_hosted_google_tag_manager_entries branch February 25, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants