Skip to content

Added key customId to set the custom Id for OUL#479

Merged
KambleSonam merged 12 commits intodevelopfrom
task/WEB-3904/customId_OUL
Feb 19, 2026
Merged

Added key customId to set the custom Id for OUL#479
KambleSonam merged 12 commits intodevelopfrom
task/WEB-3904/customId_OUL

Conversation

@KambleSonam
Copy link
Copy Markdown
Collaborator

@KambleSonam KambleSonam commented Oct 9, 2025

Changes

To handle the customId in the OUL flow, customer can add the field, customId in OUL call.
The customId will be verified, sanitised and would be set as the Clevertap Id, which will be used for subsequent calls.

Changes to Public Facing API if any

OUL call will have the parameter customId

clevertap.onUserLogin.push({
  "Site": {
    "Name": "Jack Montana",
    "Identity": 61026032,
    "Email": "jack@gmail.com",
    "Phone": "+14155551234",
    "Gender": "M",
    "DOB": new Date(),
    "customId": "my_custom_id"  // This field will set the custom ID
  }
})

How Has This Been Tested?

  • Make OUL call with the customId field. The guid should be updated.
  • Perform any event or page refresh, all the calls should have the customId set in the OUL
  • Check by making multiple OUL calls

Checklist

  • Code compiles without errors
  • Version Bump added to package.json & CHANGELOG.md
  • All tests pass
  • Build process is successful
  • Documentation has been updated (if needed)
  • Automation tests are passing

Link to Deployed SDK

Use these url for testing :

  1. https://static.wizrocket.com/staging/task/WEB-3904/customId_OUL/js/clevertap.min.js
  2. https://static.wizrocket.com/staging/task/WEB-3904/customId_OUL/js/sw_webpush.min.js

How to trigger Automations

Just add a empty commit after all your changes are done in the PR with the command

 git commit --allow-empty -m "[run-test] Testing Automation"

This will trigger the automation suite


Note

Medium Risk
Touches identity/session linkage in the OUL flow by changing how gcookie is set and persisted, which can affect user attribution if validation/prefixing or cache interactions are wrong. Logging changes are low risk but may impact integrations that rely on error-level signals.

Overview
Adds support for passing customId in onUserLogin payloads: the value is validated (length/charset), lowercased, prefixed for web, then used to set/override the stored gcookie for subsequent requests while avoiding cache-based gcookie overwrites during OUL when a custom ID is present.

Introduces Logger.reportInfo with an "info" prefix and changes null/empty-property removal reporting from reportError to reportInfo to reduce error-level noise. Also bumps the SDK version strings to 2.5.4 and updates CHANGELOG.md.

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

@KambleSonam KambleSonam requested a review from a team as a code owner October 9, 2025 07:54
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 9, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task/WEB-3904/customId_OUL

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@francispereira
Copy link
Copy Markdown

francispereira commented Oct 9, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@singhkunal2050
Copy link
Copy Markdown
Contributor

@KambleSonam can you mention the steps on how this has been tested exactly with steps? This would help the QA and Reviewers

Copy link
Copy Markdown
Contributor

@singhkunal2050 singhkunal2050 left a comment

Choose a reason for hiding this comment

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

Can we make the public api argument consistent for OUL with init

Refer https://github.com/CleverTap/clevertap-web-sdk/blob/master/src/clevertap.js#L683, we are using customId

cursor[bot]

This comment was marked as outdated.

@KambleSonam KambleSonam changed the title Added key customCTID to set the custom Id for OUL Added key customId to set the custom Id for OUL Oct 10, 2025
Copy link
Copy Markdown

@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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

this.wzrkError.c = code;
this.wzrkError.d = description;
this.info("".concat(CLEVERTAP_INFO_PREFIX, " ").concat(code, ": ").concat(description));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

reportInfo still sets wzrkError, sending info as server errors

Medium Severity

The new reportInfo method sets this.wzrkError.c and this.wzrkError.d identically to reportError. Because addSystemDataToObject sends any non-empty wzrkError as wzrk_error in every API payload, informational events (like NULL_VALUE_REMOVED and EMPTY_VALUE_REMOVED) are still transmitted to the server as error data. The change from reportError to reportInfo only affects the console log level; the server-side error reporting behavior is unchanged.

Fix in Cursor Fix in Web

let sendOULFlag = true
StorageManager.saveToLSorCookie(FIRE_PUSH_UNREGISTERED, sendOULFlag)
const addToK = (ids) => {
const addToK = (ids, customIdFlag = false) => {
Copy link
Copy Markdown
Contributor

@ThisIsRaghavGupta ThisIsRaghavGupta Feb 19, 2026

Choose a reason for hiding this comment

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

Is default false the base case?

@KambleSonam KambleSonam merged commit c63108c into develop Feb 19, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants