Skip to content

feat(analytics-browser): add config attribution.excludeInternalReferrers#1548

Open
daniel-graham-amplitude wants to merge 28 commits intomainfrom
AMP-149299-exclude-internal
Open

feat(analytics-browser): add config attribution.excludeInternalReferrers#1548
daniel-graham-amplitude wants to merge 28 commits intomainfrom
AMP-149299-exclude-internal

Conversation

@daniel-graham-amplitude
Copy link
Collaborator

@daniel-graham-amplitude daniel-graham-amplitude commented Feb 21, 2026

Summary

Adds a new configuration to attribution called excludeInternalReferrers that

  • when true or excludeInternalReferrers.condition === 'always', do not track campaign information if document.referrer and location.hostname are on the same domain (ie: block all internal referrers)
  • when excludeInternalReferrers.condition === 'ifEmptyCampaign', do not track campaign information if document.referrer and location.hostname are on the same domain and the campaign is empty (no UTM parameters or click ID's)

Why: this is so that customers can easily safeguard against unwanted internal referrers.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

Note

Medium Risk
Changes campaign attribution decision logic and domain parsing, which can alter when $identify campaign events are emitted; mistakes could suppress or misattribute marketing campaigns across subdomains/TLDs.

Overview
Adds attribution.excludeInternalReferrers to suppress campaign updates when the referrer is on the same effective domain as the current page (optionally only when campaign params are otherwise empty).

This threads cookieOptions.domain into attribution evaluation, adds domain/subdomain parsing helpers (including support for common 2-level TLDs), validates/logs invalid config values, and expands tests/exports (including EXCLUDE_INTERNAL_REFERRERS_CONDITIONS) plus a small test-server config/snippet version bump.

Written by Cursor Bugbot for commit 1ae14a2. This will update automatically on new commits. Configure here.

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as draft February 21, 2026 01:00
@daniel-graham-amplitude daniel-graham-amplitude changed the title DRAFT: feat(analytics-browser): add config attribution.excludeInternalReferrers feat(analytics-browser): add config attribution.excludeInternalReferrers Feb 21, 2026
@daniel-graham-amplitude
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@daniel-graham-amplitude
Copy link
Collaborator Author

bugbot run

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as ready for review February 23, 2026 21:57
Copy link
Contributor

@Mercy811 Mercy811 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dan, LGTM! Just one nit

@daniel-graham-amplitude
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

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.

2 participants