- Optimizely X Web Experimentation
- Optimizely X Web Personalization
- Optimizely X Web Recommendations
his article will help you:
- Implement behavioral targeting across different origins (subdomains or protocols) of your site
An “origin” is a combination of a specific hostname, protocol, and port on your site. By default, events that you track in Optimizely can only be used to target changes on the same origin. So when the snippet is running on https://shop.example.com, it can access events that were generated on https://shop.example.com, but it cannot access events that were generated on:
What if you want to run an experiment on the secure origin https://shop.example.com, targeting browsing behavior on the unsecure origin http://shop.example.com? Or what if you want to target based on reading activity on http://blog.example.com?
You can enable this by navigating to Personalization Settings and clicking on the Implementation tab. There, you can specify origins whose events Optimizely is allowed to pool together. There are several ways to specify origins:
This includes origins like http://example.com, https://shop.example.com, https://shop.example.com:80, and http://example.computer.info. As shown with the last example, this can result in data being shared with other top-level and second-level domains.
This includes all of example.com when accessed via the secure https protocol. If you do not terminate the regular expression with your domain followed by the $ character, then this can result in data being shared with other top-level and second-level domains.
You can find more information in this article on URL match types.
Want to learn more about origins and the "same-origin policy"? See this Wikipedia article for more examples.
Events are shared asynchronously across origins, so events from http://blog.example.com are not available when Optimizely first begins to execute on https://shop.example.com. As a result, behavioral targeting may not succeed until the second page load on https://shop.example.com.
Cross-domain behavioral targeting
Events are targetable across origins only for the current Optimizely User ID, which is stored in the
optimizelyEndUserId cookie. Since browsers prevent sharing cookies across domains (e.g. example.com, anotherexample.com) and across top-level domains (e.g. example.com, example.net), Optimizely is unable to set consistent user IDs across such domains.
You will need to manually sync the
optimizelyEndUserId cookie across domains, using other means, in order for cross-domain targeting to work.