Passing URL in captured Object

Passing URL in captured Object

Overview

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.


Function Usage

Static URL Example

popInWidgetInit({
  token: "12975",
  captured: {
    name: "Vijith",
    mobile: "9544510895",
    campaign: {
      url: "https://www.example.com/cars",
    },
  },
});

Dynamic URL Example

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 }, }, });

Field Descriptions

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


Notes

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


Best Practices

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

    • Related Articles

    • Passing Campaign Data via Popin & Webhook Meta

      Popin supports passing campaign and tracking data (such as UTM parameters and custom identifiers) when opening the widget. This data is automatically included in webhook payloads under the properties.meta object, ensuring consistency across all ...
    • Streamline Customer Calls by Passing Logged-in User Data to Popin

      Enhance Your Customer Experience with Pre-filled Data We understand that a seamless user experience is crucial when it comes to customer interactions. To make video calls with your agents even more effortless, Popin allows you to pass logged-in user ...
    • Passing Logged-In Customer Details to Popin

      This guide explains how to automatically pass logged-in customer data to the Popin widget. This ensures a seamless experience by skipping the manual data entry step and directly opening the widget. ? When to Use This Use this method if: The user is ...
    • Popin Webhook Integration Guide

      Popin’s webhook functionality allows you to receive real-time notifications about events happening in your Popin widget. This guide explains how to set up webhooks and describes the event payloads you can expect to receive. Setting Up Webhooks Log in ...
    • Popin Insta Call API Documentation

      This documentation covers the Popin Insta Call APIs for capturing users, creating video call links, retrieving available time slots, and scheduling video calls, with full support for advanced routing, tracking, and customization options. 🔐 ...