These configurations let different instances of ID service code implemented in an iFrame and on the parent page communicate with each other. They’re designed to help resolve problems with 2 specific use cases where you may or may not control the parent page/domain and you have ID service code loading in the iFrame of a domain that you do control. They are available in VisitorAPI.js code version 2.2, or higher.
Contents:
Both configuration elements are required when you use this code.
Configuration Syntax | Description |
---|---|
whitelistParentDomain: " Domain name of parent page " |
Accepts a single domain name passed in as a string. |
whitelistIframeDomains: [ "iFrame domain","iFrame domain","iFrame domain" ] |
Accepts one or more iFrame domain names passed in as an array. |
Your configured ID service code could look similar to this example.
//Instantiate Visitor
var visitor = Visitor.getInstance("Insert Experience Cloud Organization ID here",{
...
//Add parent page domain name and iFrame domain names
whitelistParentDomain: "parentpageA.com",
whitelistIframeDomains: ["iFrameDomain1.com","iFrameDomain2.com"],
...
}
);
These configurations help solve the problem of setting an ID service cookie and assigning a visitor ID when browsers block third-party cookies and if either of these conditions apply:
You may also want to implement these configurations when you’re serving video in an iFrame with Video Heartbeat. Video Heartbeat needs an ID service ID (the MID) to work properly.
Use Case 1: The Browser Blocks Third-Party Cookies and the ID Service is Implemented on the iFrame and Parent Page
Use Case Element | Description |
---|---|
Conditions |
This use case includes the following conditions:
|
Results |
Given these conditions, the ID service:
|
Solution |
Modify the ID service Visitor.getInstance function in the iFrame with these white list configurations. Specify the parent and child domains in the code. These configurations let the ID service code in the iFrame check the ID service code on the parent page for a visitor ID. If the ID service code in the iFrame doesn't receive a response parent page, these configurations generate a local visitor ID. |
Use Case 2: Requesting an ID from an iFrame embedded in a parent page you do not control or that does not use the ID service
Use Case Element | Description |
---|---|
Conditions |
This use case includes the following conditions:
|
Results |
Given these conditions, the ID service:
|
Solution |
Modify the ID service Visitor.getInstance function in the iFrame with these white list configurations. Specify the parent and child domains in the code. These configurations let the ID service code in the iFrame check the ID service code on the parent page for a visitor ID. If the ID service code in the iFrame doesn't receive a response parent page, these configurations generate a local visitor ID. |
You can implement these configurations safely because:
The ID service supports a limited set of public API methods when you implement these white list configurations. The supported methods vary according to the use case scenarios described above.
Use Case | Supported Methods |
---|---|
Case 1 |
|
Case 2 |
|