fix: BuilderComponent injects pixel unconditionally#4538
fix: BuilderComponent injects pixel unconditionally#4538AishwaryaParab wants to merge 1 commit intomainfrom
Conversation
|
|
| 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
| ); | ||
|
|
||
| if (data && !hasPixel && blocks.length > 0) { | ||
| if (data && !hasPixel && blocks.length > 0 && builder.canTrack) { |
There was a problem hiding this comment.
This change could have unintended repercussions, particularly around pageviews calculations. Could we review the ask again for this change?
There was a problem hiding this comment.
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.

Description
In React Gen 1 SDK, we can disable tracking by:
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.canTrackis 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 underlyingbuilderNoTrackflow) is set.BuilderComponentnow filters out any existingbuilder-pixelblock when tracking is disabled and only appends a new pixel viagetBuilderPixel()when tracking is enabled, preventing unwantedcdn.builder.io/api/v1/pixelrequests.Reviewed by Cursor Bugbot for commit 9f93afd. Bugbot is set up for automated code reviews on this repo. Configure here.