The popInWidgetInit
function allows you to initialize a widget with user-specific and campaign-specific data. One of the key fields you can include is the URL where the widget is triggered. This is useful for tracking the source page or marketing campaign that led to user interaction.
popInWidgetInit({
token: "12975",
captured: {
name: "Vijith",
mobile: "9544510895",
campaign: {
url: "https://www.example.com/cars",
},
},
});
To dynamically capture the current page URL, use window.location.href
:
popInWidgetInit({
token: "12975",
captured: {
name: "Vijith",
mobile: "9544510895",
campaign: {
url: window.location.href, // captures the current page URL dynamically
},
},
});
token (string):
Required. A unique identifier for your widget instance.
captured (object):
Required. Contains data to be captured during the widget session.
name (string):
The name of the user interacting with the widget.
mobile (string):
The mobile number of the user.
campaign (object):
Optional. Holds campaign-specific metadata.
url (string):
The full URL of the page or campaign where the widget is triggered. This must be a valid, properly formatted URL including the http://
or https://
prefix.
The url
value must always be a valid and fully qualified URL (e.g., https://www.example.com/page
).
You can pass either a static URL (hardcoded), or a dynamic one using window.location.href
.
Always include the full URL with https://
or http://
to avoid malformed links.
Use window.location.href
to dynamically capture the current page.
Avoid using relative URLs (e.g., /sell-used-cars
) — always use full URLs.
Perform URL validation or sanitization on your backend to prevent misuse or incorrect data capture.