Analytics Platform Integration is an Experience OS extension that enables you to track and analyze the performance of your personalized experiences.
The Analytics Platform Integration connector enables you to integrate with the analytics platform of your choice to create reports for your Dynamic Yield campaigns. View data regarding sessions and user behavior concerning experiences or variations, or tag users who were exposed to a specific experience.
Note: See also our out-of-the-box, code-free Google Analytics 4 integration extension.
Setting up a custom analytics platform integration
- Go to Experience OS App Store › Analytics Platform Integration and click Install.
- Click Configure extension.
Select the triggers that will determine when the custom integration code is run.
- Variation Impressions (standard): Analyze the behavior of users who were served a variation.
- Recommendation Impressions: Analyze the behavior of users who were served a specific strategy.
- Variations Rendered on a Page: Analyze the behavior of users who clicked on Dynamic Content or Recommendation campaigns.
When selecting the hooks, see the included documentation for the following guidance:
- How does the code work?
- Object example
- Attribute descriptions
- Sample code
- Assumed cookie consent only: If you are using any of our Visitor Data Privacy Management APIs, you need to use a dedicated API to ensure that no data is sent to a third party for users who do not consent.
- By default, the analytics platform integration is served when any campaign is triggered according to this configuration. You can manually enable or disable the integration for individual campaigns using the procedure described in Enabling and disabling a custom integration per campaign.
Managing the Analytics Platform Integration connector
In the Web Personalization app, go to the Extensions tab. Here you can select one of the following three options:
Enabling and disabling a custom integration per campaign
By default, the custom analytics platform integration will be enabled for all campaigns. The integration can be turned off per campaign. This is done in the Advanced Settings of the campaign.
- When editing or creating a campaign, go to Advanced Settings.
- Turn off (or on) Track campaign performance in your analytics platform.
Troubleshooting custom analytics integrations
If you've set up your custom analytics integration, but are not seeing Dynamic Yield campaign data in your analytics platform, try these methods to troubleshoot the integration code and confirm that it is working as expected.
If after trying these actions events are still not triggered for Dynamic Yield campaigns, contact technical support.
Using console.log() is a classic method in debugging code. It writes strings of text to the console of your browser’s dev tools (press ⌘+⌥+J for MacOS or Ctrl+Shift+J for Windows). In the following example, console.log() is used to check whether our code executes successfully and that values are being assigned to our variables.
To take this a step further, you can use console.log() to make sure the Dynamic Yield campaign data is being assigned to the variables passed in the afterVariationSelected function.
Breakpoints can be used to stop the execution of code in the browser, which enables you to step through the code line by line to review it.
To add breakpoints to the code contained in your custom analytics integration:
- Open dev tools in your browser (press ⌘+⌥+J for MacOS or Ctrl+Shift+J for Windows).
- Click the three dots on the menu bar, and then click Open File.
- Search for “api_dynamic” and open the JS file by clicking on it.
- Click Pretty-Print.
- Search for the name of the function from your custom analytics integration code. In this example we searched for “afterVariationSelected”. However, this might be different depending on the type of custom integration you’re using. Refer back to your integration in Dynamic Yield if you’re not sure what to use in your search.
- Click line numbers to add breakpoints where want to stop the code from executing. In this example, we added a breakpoint to stop the code before it executes the gtag event.
- Refresh the page you are troubleshooting. In the dev tools console, you can see the page stop loading, and your breakpoint is displayed.
You can now see what values are assigned to the minified variables that are passed in the afterVariationSelected function. If you resume the execution of the code, you might see that it iterates through and stops at the same breakpoint multiple times if you are firing the custom analytics integration code for multiple campaigns on the page.
Note that you will not see the code iterate through campaigns that do not have the custom analytics integration toggle enabled in the campaign settings.
- Experiment by adding additional breakpoints in the code, or use Step to step through the code after the breakpoint is reached.
Use the correct event measurement code for Google Analytics
If you’re still not seeing Dynamic Yield campaign events in Google Analytics, you might be using the wrong syntax in your event measurement code. Depending on your implementation, you must use either the ga() or gtag() syntax.
To verify the correct code syntax for your site, see the Google Analytics 4 article.