fix: conversion not being tracked properly with builder action
Description
Gen 1 :
- expose
contentIdon the builder class - update the
trackConversionmethod to figure outcontentIdandvariantionIdif they are undefined from the SDK value and cookies.
Gen 2:
- add track and trackConversion methods to the builder globals object.
- add
BuilderGlobalContextclass to share context variables between components and helper functions in the gen2 sdks
Issue : https://www.loom.com/share/6bcecbfc1b284331a867f162223e4c20
Loom - Gen 1 fix https://www.loom.com/share/3712e28c436b4d9eac9bd3e6a2a68325
Loom - Gen 2 fix https://www.loom.com/share/fc3b894372d244d8b0c2a14e67ed93ec
[!NOTE] Ensure conversions capture contentId and variationId via instance/global context and cookies, adding tracking APIs, inlined context setup, and comprehensive tests.
- Core (Gen1):
- Expose
Builder.contentId(reactively) and set it in React components on content load/inline render.- Enhance
Builder.trackConversionto derivecontentIdfrom instance andvariationIdfrom test cookie; ignore variant when equal to content.- Add extensive unit tests for conversion parameter handling and edge cases.
- SDKs (Gen2):
- Add global context singleton (
initializeGlobalBuilderContext) and inject setup script fromContentto storeapiKey,apiHost, andcontentId.- Extend
builderglobals withtrackandtrackConversion, using global context andgetTestCookie.- Expose/init variant/helper scripts to window (incl. global context initializer) for A/B and personalization flows.
- E2E/Specs:
- New conversion tracking pages/specs for basic, variant (cookie-driven), symbol, and section scenarios.
- Export test helpers; register new routes/content in specs.
- Tooling/Docs:
- Add
watch:sdkscript; document alternative Yarn link workflow in SDK develop docs.- Changeset: patch releases for affected
@builder.io/*packages.Written by Cursor Bugbot for commit 2ff9c7f6c16447b787719391381b54d5df8ccb64. This will update automatically on new commits. Configure here.
🦋 Changeset detected
Latest commit: 2ff9c7f6c16447b787719391381b54d5df8ccb64
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 10 packages
| Name | Type |
|---|---|
| @builder.io/react | Patch |
| @builder.io/sdk | Patch |
| @builder.io/sdk-angular | Patch |
| @builder.io/sdk-react-nextjs | Patch |
| @builder.io/sdk-qwik | Patch |
| @builder.io/sdk-react | Patch |
| @builder.io/sdk-react-native | Patch |
| @builder.io/sdk-solid | Patch |
| @builder.io/sdk-svelte | Patch |
| @builder.io/sdk-vue | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
🤖 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 2ff9c7f6c16447b787719391381b54d5df8ccb64
| Command | Status | Duration | Result |
|---|---|---|---|
nx test @snippet/angular-17-ssr |
❌ Failed | 6m 23s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-10-01 05:38:09 UTC
⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
🔎 Detected hardcoded secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 21273596 | Triggered | Generic High Entropy Secret | 9245f6d86800a7b05c7a06518e427eb3d58842d8 | packages/sdks-tests/src/specs/track-conversion.ts | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.