Developer Platform
  • Home
  • Getting Started
    • General Information
    • Features Overview
    • Security
  • APPs
    • Public Apps
      • Shopify
      • Salesforce
      • Zendesk
      • Google Analytics
    • Build your App
      • Getting started
      • My Apps
      • App information
      • App Parameters
      • App Plugins
      • Add Webhooks
      • Submit your Apps
      • App security
      • Developer Policy
  • Use Cases
    • Copilots
      • Product Catalog sync through API
      • FAQ sync through API
    • Visitor experience
      • Integrating custom buttons into your site
      • Check availability before escalating to iAdvize
      • Authenticated Messaging
        • Introduction
        • Web client-side implementation
          • Authenticated Messaging overview
          • Brief timeline of the integration process
          • How to enable authenticated mode in the administration portal?
          • How to implement the customer authentication backend (token provider)?
          • How to authenticate with iAdvize in client's website?
          • How to deal with activation success or failure?
          • How to logout?
          • Compatibility with Mobile SDK
          • FAQ
        • Web backend implementation
          • Important information and recommendations
          • Signature and Encryption Detailed Process
          • Technical backend implementation
          • FAQ
      • Cross-domain Conversation Continuity
      • Customize replies with Markdown
    • Agent workspace
      • Custom App example and step-by-step tutorial
        • Get Started
        • Work with the Desk
        • Intent / Trigger
        • JWT
        • References
    • Administration
      • Users
        • SAML SSO Authentication - Implementation Guide
        • Create, update and delete users via API
        • Manage the availability of your users with the iAdvize API
        • Integrate the iAdvize conversation panel into an existing tool
    • Data & Analytics
      • Anonymize a conversation or visitor data
      • Create a custom dashboard
      • Find contact data using GraphQL
      • Retrieve conversations data
      • Retrieve messages exchanged within a conversation
  • Technologies
    • GraphQL API
      • Terminology
      • Reference
      • Authentication
      • Schema lifecycle
      • Error Management
      • Pagination
    • REST API (deprecated)
      • Statistic (deprecated)
      • Group (deprecated)
      • Call meeting (deprecated)
      • Operator (deprecated)
      • Skill (deprecated)
      • Transaction (deprecated)
      • Visitor (deprecated)
    • Webhooks
      • Reference
      • Guides
    • Desk events
      • Reference
    • Web & Mobile SDK
      • Javascript Web SDK
        • Reference
      • Javascript Callbacks
        • Reference
        • Guides
      • Mobile SDK
        • Fourme (latest)
        • Epoisses
        • Dauphin
        • Cantal
        • 🤝Support Policy
        • 🤔Frequently Asked Questions
    • Custom App
    • External Bot
      • Implementation
        • Configuration flow
        • Conversation flow
        • Conversation objects
      • Configuration
      • FAQ
      • Best practices
Powered by GitBook
On this page

Was this helpful?

  1. Use Cases
  2. Visitor experience

Cross-domain Conversation Continuity

Implement cross-domain conversation continuity in the era of first-party cookies.

PreviousFAQNextCustomize replies with Markdown

Last updated 6 months ago

Was this helpful?

Discover how iAdvize handles data storage in this Help Center article :

Since the , iAdvize can no longer reliably link visitor identities across domains. While this is good news for privacy in general, it means that multi-domain clients need to add a query parameter to their pages to maintain conversation continuity between websites that do not share a top-level domain. The principle is as follows. First, you need to detect whether the visitor browsing the website is in the middle of a conversation. To do this, we need to use the iAdvize web SDK and, more specifically, the on the conversation:id property. If the Web SDK returns a conversation identifier, then a conversation is in progress.

If the visitor is in the middle of a conversation on site A, and clicks on a link that will take him to site B, you'll need to add a specific url parameter to this link (named “idzconvid”, and which will take as its value the conversation identifier retrieved from the iAdvize.get method) so as to guarantee conversation continuity between site A and site B.

This is how it should be implemented :

  1. Use the iAdvize WebSDK to retrieve the conversationId when a conversation is ongoing :

window.iAdvizeInterface.push((iAdvize) => {
  iAdvize.on("conversation:idChange", (conversationId) => {
    // This is triggered when : 
    // - a conversation starts : conversationId is a string
    // - a conversation ends : conversationId is null
  });
});
  1. Add the conversationId to all relevant links.

Here is a full example of what it might look like :

<script>
  /**
   * Script setup
   * You should use your own values
   **/
  window.iAdvizeInterface = window.iAdvizeInterface || [];
  iAdvizeInterface.config = {
      "sid": 1234,
      "lang": "en",
      "useExplicitCookiesConsent": true
  };

  /**
   * Function to update all the links on the website's page.
   * We need them to include the conversation identifier, 
   * so cross-domain conversations can be continued.
   **/
  function updateLinksWithConversationId(conversationId) {
    // List of allowed top level domains, on which we want conversation continuity
    const TOP_LEVEL_DOMAINS = ["my-first-domain.com", "my-other-domain.net"];
    // The query param key we will add to relevant links
    const queryParam = "idzconvid";

    const links = document.body.querySelectorAll("a");
    for (const link of links) {
      let originalUrl;
      try {
        originalUrl = new URL(link.href);
      } catch (error) {
        continue;
      }
      const isRelevantLink = TOP_LEVEL_DOMAINS.some((domain) =>
        originalUrl.hostname.includes(domain)
      );
      if (!isRelevantLink) continue;
      originalUrl.searchParams.delete(queryParam);
      if (conversationId) {
        originalUrl.searchParams.append(queryParam, conversationId);
      }
      link.href = originalUrl.href;
    }
  }

  // When iAdvize is loaded :
  window.iAdvizeInterface.push((iAdvize) => {
    // Change relevant links if a conversation is already ongoing
    updateLinksWithConversationId(iAdvize.get("conversation:id"));
    // Listen to conversationId changes to update relevant links
    iAdvize.on("conversation:idChange", updateLinksWithConversationId);
  });
</script>

<!-- Launch the iAdvize tag -->
<script async src="//halc.iadvize.com/iadvize.js"></script>

See an example in this codesandbox :

https://help.iadvize.com/hc/articles/216438047
2024 phase-out of third-party cookies
iAdvize.get method
https://codesandbox.io/p/sandbox/cross-domain-conversation-continuity-hyx6fx