- Optimizely Feature Experimentation
- Optimizely Web Experimentation
- Optimizely Personalization
Some privacy-focused browsers and extensions might block Optimizely Experimentation from running on your website. These tools check the domain name whenever your browser makes an HTTP request and block the request if the domain is on a list of known tracking platforms.
You must configure a reverse proxy to ensure Optimizely works correctly on your website. This routes Optimizely-related requests through your domain, reducing the chances of these requests being blocked.
Step 1: Create a reverse proxy server
Deploy a proxy server to forward requests destined for Optimizely's domains. You can do this on various cloud providers and CDNs, including AWS, GCP, Azure, Cloudflare, and Akamai.
See the relevant cloud provider or CDN documentation:
- Amazon API Gateway HTTP API
- Amazon CloudFront
- GCP Cloud Load Balancing
- GCP Cloud CDN
- Azure Front Door
- Cloudflare CDN
- Akamai CDN
Step 2: Configure routes
Add the following routes to your reverse proxy. An asterisk (*) represents a wildcard.
Create a route to handle POST requests to https://logx.optimizely.com/v1/events
for logging events:
-
Feature Experimentation – Create a route to handle GET requests to
https://cdn.optimizely.com/*
. -
Web Experimentation or Optimizely Personalization
- If you use a PCI-compliant snippet, create a route to handle GET requests to
https://cdn-pci.optimizely.com/*
. - Otherwise, create a route to handle GET requests to
https://cdn.optimizely.com/*
.
- If you use a PCI-compliant snippet, create a route to handle GET requests to
Step 3: Update references to Optimizely’s domains
If you use Web Experimentation, update the script tag on your website to request the snippet from your reverse proxy instead of Optimizely’s CDN.
EVENT_TRACKING_HOST
build setting. Provide your Optimizely account ID, the project IDs to be updated, and your proxy URL.If you use Feature Experimentation, update the SDK client to request the data file from your reverse proxy instead of Optimizely’s CDN.
The following is an example using the JavaScript SDK:
const optimizely = require('@optimizely/optimizely-sdk');
const optimizelyClient = optimizely.createInstance({
sdkKey: '[YOUR_SDK_KEY]',
datafileOptions: {
urlTemplate: 'https://[YOUR_PROXY_URL]/datafiles/%s.json'
}
});
Additionally, implement a custom event dispatcher to route events through your proxy. Modify the built-in event dispatcher to send events to your proxy's endpoint. Learn more about the JavaScript (Browser) SDK event dispatcher.
By implementing the reverse proxy, you can prevent privacy-focused browsers and extensions from blocking Optimizely on your website.
Please sign in to leave a comment.