The Dynamic Yield scripts should be added to the <head> tag of your site, on any page. Once implemented, your visitor activity will be tracked, Dynamic Yield campaigns can be served on your site.
- In the Dynamic Yield admin, go to Settings › General Settings.
- Copy and paste the code snippet immediately after the opening <head> tag of every page on your site.
- Script placement:
- We recommend placing scripts in the <head> tag to avoid flickering.
- Implement the Dynamic Yield scripts right after the page context.
- Implementation method: Implement the Dynamic Yield script directly on your site's code, and not with a Tag Manager to avoid flickering.
- Synchronicity: If you configure the scripts to run asynchronously, unexpected behaviors will occur affecting which variations are shown, loading times, flicker, etc. Dynamic Yield provides a high server redundancy rate and lightning-fast loading times so you don’t need to resort to asynchronous loading to speed things up. All other operations after loading the scripts are run asynchronously.
Adding Prefetch and Preconnect Tags
Since the Dynamic Yield scripts are served from a different hostname than your website, the browser needs to resolve the DNS. Place a dns-prefetch tag before the script to reduce the DNS resolution time.
Preconnect tags allow the browser to setup early connections before an HTTP request is actually sent to the server. This eliminates roundtrip latency and saves time for users. Some browsers (e.g. Explorer, Safari iOS) do not support preconnect tags and ignores it.
These calls are included by default in the script provided in the Settings › General Settings page that should be copied to every page in your site.
<link rel="preconnect" href="//cdn.dynamicyield.com">
<link rel="preconnect" href="//st.dynamicyield.com">
<link rel="preconnect" href="//rcom.dynamicyield.com">
<link rel="dns-prefetch" href="//cdn.dynamicyield.com">
<link rel="dns-prefetch" href="//st.dynamicyield.com">
<link rel="dns-prefetch" href="//rcom.dynamicyield.com">
Script Architecture and Advanced Details
We currently execute multiple code sections on the customer web site in order to perform:
- Data collection
- Parameter gathering
- Decision making
- Experiments execution (including tags and actions)
This section describes all scripts executed on the customer web page, the timeline on which they execute and dependencies between them.