Insightech and Dynamic Yield
Updated
by Tami Lopez
Overview
Dynamic Yield is an AI-driven personalisation and A/B testing platform used by enterprise teams to run experiments, personalise content, and optimise digital experiences. It determines which campaign variation each visitor sees, enabling teams to safely test and measure changes across web and app surfaces.
This document explains how to integrate Dynamic Yield campaign and variation data with Insightech by pushing experiment details into the website's dataLayer using Dynamic Yield's built-in Analytics Platform Integration. Because Insightech captures all dataLayer events automatically, no additional Insightech configuration is required beyond the standard setup.
What This Integration Does
The integration captures Dynamic Yield campaign data and pushes it to your dataLayer every time a visitor is served a variation — including visitors placed in the control group — allowing Insightech to record every experiment the visitor was exposed to.
This includes:
- Campaign ID – The unique numeric identifier of the campaign (tagId)
- Campaign Name – The human-readable campaign name (tagName)
- Experience ID – The unique ID of the experience within the campaign
- Experience Name – The name of the specific experience (A/B variation) served
- Variation ID – The unique ID of the variation served to this visitor
- Variation Name – The human-readable name of the variation served
- Is No-Action – Whether this visitor was placed in the control (no-action) group
This enables Insightech to:
- Unify your data – Combine A/B test data with behavioural analytics in Insightech
- Create advanced segments – Build audiences based on specific tests, variants, and experiences
- Behavioural Attribution – Understand how tests impact downstream metrics such as on-page engagement, AOV, and conversions
- Explore successful and failed tests – Analyse on-page behaviours and customer journeys to understand why tests succeeded or failed, informing further improvements
Implementation Steps
This integration uses Dynamic Yield's built-in Analytics Platform Integration connector. The function below is pasted directly into the DY dashboard — no separate script tag or GTM tag is required.
Prerequisites before implementing:
- The Dynamic Yield script must already be deployed on the page
- The Analytics Platform Integration must be installed from the Experience OS Store.
- For each campaign you want to track, the 'Execute Custom Integrations' toggle must be enabled in the campaign's advanced settings (it is on by default for new campaigns).
Step 1: Install the Analytics Platform Integration
- In Dynamic Yield, go to Experience OS Store and search for Analytics Platform Integration
- Click Install, then click Configure Extension
- Under Triggers, select Variation Impressions (standard) — this fires the function each time a campaign variation is served to any visitor
- Paste the code below into the JavaScript editor and click Save
Step 2: Paste the Integration Code
// Install this code via: Experience OS Store > Analytics Platform Integration
// Configure: Trigger = 'Variation Impressions', then paste this function
function afterVariationSelected(tagId, tagName, experienceName, experience, variations, isNoAction) {
try {
window.dataLayer = window.dataLayer || [];
if (isNoAction) {
// Visitor placed in the control (no-action) group
var controlVariation = variations[0] || {};
var campaign = {
dy_campaignId: String(tagId),
dy_campaignName: decodeURI(tagName || ''),
dy_experienceId: String(experience.id || ''),
dy_experienceName: decodeURI(experienceName || ''),
dy_variationId: String(controlVariation.id || ''),
dy_variationName: 'Control',
dy_isNoAction: 'true',
};
window.dataLayer.push({
event: 'dy_variation_impression',
dy_campaignId: campaign.dy_campaignId,
dy_campaignName: campaign.dy_campaignName,
dy_experienceId: campaign.dy_experienceId,
dy_experienceName: campaign.dy_experienceName,
dy_variationId: campaign.dy_variationId,
dy_variationName: campaign.dy_variationName,
dy_isNoAction: campaign.dy_isNoAction
});
} else {
// Visitor served one or more active variations
variations.forEach(function(variation) {
var campaign = {
dy_campaignId: String(tagId),
dy_campaignName: decodeURI(tagName || ''),
dy_experienceId: String(experience.id || ''),
dy_experienceName: decodeURI(experienceName || ''),
dy_variationId: String(variation.id || ''),
dy_variationName: decodeURI(variation.name || ''),
dy_isNoAction: 'false',
};
window.dataLayer.push({
event: 'dy_variation_impression',
dy_campaignId: campaign.dy_campaignId,
dy_campaignName: campaign.dy_campaignName,
dy_experienceId: campaign.dy_experienceId,
dy_experienceName: campaign.dy_experienceName,
dy_variationId: campaign.dy_variationId,
dy_variationName: campaign.dy_variationName,
dy_isNoAction: campaign.dy_isNoAction
});
});
}
} catch(e) {
console.warn('DY dataLayer integration error:', e);
}
}
Step 3: Verify Each Campaign Has Tracking Enabled
This integration pushes a single dy_variation_impression event to the dataLayer each time a campaign is evaluated for a visitor — including visitors placed in the control group. It fires once per campaign per page load.
The dy_variation_impression Event
Fires once for each campaign the visitor is evaluated against. This includes both active variation assignments and control group placements. Use this event for granular per-campaign segmentation in Insightech.
{
event: 'dy_variation_impression',
dy_campaignId: '123456',
dy_campaignName: 'Homepage Hero Test',
dy_experienceId: '98765',
dy_experienceName: 'Blue CTA Button Test',
dy_variationId: '789',
dy_variationName: 'Blue CTA Button',
dy_isNoAction: 'false'
}Field | Example Value | Description |
dy_campaignId | '123456' | The unique numeric ID of the campaign (maps to tagId in DY) |
dy_campaignName | 'Homepage Hero Test' | The human-readable campaign name (maps to tagName in DY) — use this as your experiment identifier in Insightech |
dy_experienceId | '98765' | The unique numeric ID of the experience within the campaign |
dy_experienceName | 'Blue CTA Button Test' | The name of the experience group within the campaign (maps to experienceName in DY) — distinct from the variation name |
dy_variationId | '789' | The unique numeric ID of the variation. Set to the control variation’s ID when dy_isNoAction is 'true' |
dy_variationName | 'Blue CTA Button' | The human-readable variation name. Set to 'Control' when dy_isNoAction is 'true' |
dy_isNoAction | 'false' | String: 'true' if visitor was placed in the control group; 'false' for all served variations |
Setting Up / Configuring Insightech
Once the integration is live, Insightech will automatically capture the dataLayer events and make them available in the AB Test report, accessible from your left menu.
Clicking into this menu, you will be prompted to search for your Dynamic Yield event name and select which attributes to use for your experiment campaign and variant details.
Once configured, your Dynamic Yield data will start populating the AB testing report for any active campaigns tracked using this method.
Recommended Field Mapping
Insightech Field | Dynamic Yield DataLayer Field | Notes |
Experiment / Campaign Name | dy_campaignName | Human-readable test identifier; matches tagName in DY |
Variant Name | dy_variationName | Human-readable variation name; 'Control' for no-action visitors |
Variant ID | dy_variationId | Numeric variation ID; useful for programmatic filtering |
Experience Name | dy_experienceName | The experience within the campaign that was served |
Control Flag | dy_isNoAction | String: 'true' = visitor in control group, 'false' = active variation; use for segments |
Verifying the Integration Is Working
- Open your website in a browser
- Open the browser developer console (F12 or right-click → Inspect → Console)
- Type dataLayer and press Enter
- Look for dy_variation_impression events in the output — one per active campaign on the page
- Verify the data structure matches the examples above and that dy_campaignName and dy_variationName are populated
- Confirm that control group visitors show dy_isNoAction: 'true' (as a string) and dy_variationName: 'Control'
✓ You should see a dy_variation_impression event for each active campaign on the page.
✓ For control group visitors, dy_isNoAction will be the string 'true' and dy_variationName will be 'Control'.
Troubleshooting
When DataLayer Events Are Not Appearing
Verify the Analytics Platform Integration is installed and configured
- Go to Experience OS Store and confirm the Analytics Platform Integration is installed and enabled.
- Click Configure Extension and confirm that Variation Impressions is selected as a trigger.
- Confirm your integration code is saved in the JavaScript editor.
Check the Execute Custom Integrations toggle per campaign
- In each campaign's Advanced Settings, confirm the Execute Custom Integrations toggle is turned on.
- Campaigns with this toggle disabled will not fire the afterVariationSelected function, even if the integration is installed globally.
Check for JavaScript errors
- Open the browser console and look for any errors that may indicate the integration code failed.
- Confirm the Dynamic Yield script is loading successfully on the page by checking for the DY and DYO global objects in the console.
When There Is No Campaign Data in Events
Check the Dynamic Yield dashboard
- Confirm that the campaigns you are testing are published and active.
- Verify that targeting rules are configured and that the current visitor satisfies the targeting conditions.
- This integration works only with script-based campaigns. API-only DY implementations are not supported.
Verify the page is within campaign targeting scope
- Go to the campaign's targeting settings and confirm the current page URL is within scope.
- If using URL-based targeting rules, ensure the page path matches exactly, including any query string or hash requirements.
If Events Are Firing Multiple Times
Check for duplicate integration code
- Ensure the afterVariationSelected function is defined only once in the Analytics Platform Integration editor.
- Do not add a separate copy via GTM or a page script tag alongside the Analytics Platform Integration — this will cause the dataLayer push to fire twice per campaign.
- If you have previously installed the Google Tag Manager Connector or GA4 Connector in DY, note that these also use the same integration hook. Having both the Analytics Platform Integration and a native DY connector enabled simultaneously may cause duplicate events.
Quick Reference: DataLayer Fields
Field | Event | Type | Description |
event | dy_variation_impression | String | Always 'dy_variation_impression' |
dy_campaignId | dy_variation_impression | String | Unique numeric ID of the DY campaign (tagId) |
dy_campaignName | dy_variation_impression | String | Human-readable campaign name (tagName) |
dy_experienceId | dy_variation_impression | String | Unique numeric ID of the experience |
dy_experienceName | dy_variation_impression | String | Name of the experience served (experienceName) |
dy_variationId | dy_variation_impression | String | Unique numeric ID of the variation. Control group ID when dy_isNoAction is 'true' |
dy_variationName | dy_variation_impression | String | Human-readable variation name. 'Control' when dy_isNoAction is 'true' |
dy_isNoAction | dy_variation_impression | String | String: 'true' if visitor is in the control group; 'false' for active variations |