Skip to content

fix: BuilderComponent injects pixel unconditionally#4538

Open
AishwaryaParab wants to merge 1 commit intomainfrom
disable-tracking
Open

fix: BuilderComponent injects pixel unconditionally#4538
AishwaryaParab wants to merge 1 commit intomainfrom
disable-tracking

Conversation

@AishwaryaParab
Copy link
Copy Markdown
Contributor

@AishwaryaParab AishwaryaParab commented Apr 24, 2026

Description

In React Gen 1 SDK, we can disable tracking by:

builder.canTrack = false
OR
window.builderNoTrack = true

However, even after setting these, the pixel call (cdn.builder.io/api/v1/pixel) was still being fired, which means that any site was unknowingly firing a tracking request on every page load, even when users had not given consent.

This PR fixes that issue by respecting the above flags, when set for react gen1 sdk.

Screenshot
Before:
https://www.loom.com/share/7af5a1fac80647278991ef413b7151c0

After:
https://www.loom.com/share/fbd2247d47304adb905a78ab3690c977


Note

Low Risk
Low risk behavior change limited to tracking: the Builder pixel block is now removed/never appended when builder.canTrack is false, which could reduce analytics/events but should not affect page rendering otherwise.

Overview
Ensures the React Gen1 SDK fully disables tracking when builder.canTrack (or the underlying builderNoTrack flow) is set.

BuilderComponent now filters out any existing builder-pixel block when tracking is disabled and only appends a new pixel via getBuilderPixel() when tracking is enabled, preventing unwanted cdn.builder.io/api/v1/pixel requests.

Reviewed by Cursor Bugbot for commit 9f93afd. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

⚠️ No Changeset found

Latest commit: 9f93afd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@AishwaryaParab AishwaryaParab changed the title disable tracking fix: BuilderComponent injects pixel unconditionally Apr 24, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 24, 2026

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 9f93afd

Command Status Duration Result
nx test @snippet/gen1-remix ❌ Failed 1m 21s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-24 05:02:20 UTC

@AishwaryaParab AishwaryaParab requested review from a team and sanyamkamat and removed request for a team April 24, 2026 04:37
);

if (data && !hasPixel && blocks.length > 0) {
if (data && !hasPixel && blocks.length > 0 && builder.canTrack) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change could have unintended repercussions, particularly around pageviews calculations. Could we review the ask again for this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I've sent a loom to Manish clarifying this. Currently, if canTrack is false, we don't make the track calls. So, it's working fine currently.

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