Integrate with Google Analytics
Step 1: Set up the data layer in Google Analytics
- Go to Settings › Integrations and click Google Analytics.
- In the sidebar, click the Enable Integration slider.
- Select the Google Analytics Implementation type.
- Use the Tag Manager option to integrate with Google Analytics 4. Tag Manager lets you populate your data layer with campaign information that you can then use to trigger Google Analytics events in the Tag Manager. To configure this type of integration, continue to the next step
Universal and Classic are earlier versions of the Google Analytics script, and they remain available until the product sunset. If you select one of these options, just click Save and your integration is complete. You can now skip to Disabling the Integration for Individual Campaigns.
Note: The Universal and Classic integrations assume you have only one Google Analytics object on your site. If you have multiple objects on the same page or renamed your Google Analytics object, the integration won't work, as Dynamic Yield won't know which Google Analytics property to send the events to. In this case, use the Tag Manager implementation type instead.
- In the Data Layer Name field, enter dataLayer unless you've modified the code Google Tag Manager provides. In the GTM Event Name field, enter a name of your choice. In this documentation, we use dy_variation_impression.
- To verify that dataLayer events are populated, visit a page or screen on your property, where one of your campaigns is running. Open the browser console and inspect the data layer. You should see that the integration triggered the dy_variation_impression event. The event has two properties, which you will use next in Google Tag Manager:
- eventAction, containing the campaign name
eventLabel, containing the experience name followed by the variation name in parentheses.
Step 2: Set up tags in the Google Tag Manager
- Go to Google Tag Manager.
- >Unless you've already created them, create a data layer variable for each property in the dataLayer event: eventAction and eventLabel.
You now have 2 variables:
- Create a trigger to fire on dataLayer event name: dy_variation_impression
- Create a tag of type GA4 Event, named DY Impression Event.
In the Event Parameters, specify two parameters: dy_campaign_name and dy_experience_variation_name, and populate them with the variables you created in step 2. Configure the tag to run upon the trigger you created in step 3.
Step 3: Preview your container
Visit a page where a Dynamic Yield campaign is running and make sure the Google Analytics event is fired correctly. You can also use the Google Analytics 4 real-time dashboard to verify events are received.
Disable the integration for individual campaigns
When the Google Analytics integration is enabled, data is sent about each of your campaigns. However, you can disable it for individual campaigns.
- When editing a campaign, click the edit icon in the top section to edit the campaign settings.
- In Advanced Settings, disable the Fire Google Analytics event toggle.
Using Dynamic Yield events in Google Analytics Universal
With the exception of Dynamic Links, Dynamic Yield experiences send information to Google Analytics as events:
- In Google Analytics, go to Behavior › Events › Overview.
- Search for events named DY Smart Action or DY Smart Object under the Event Category. These two categories are based on legacy names for Dynamic Yield campaigns. They have reports on different types of campaigns enabled in Dynamic Yield for the integration. Click them to see more information.
- Click Event Action as the primary dimension to see details about campaigns. Click Event Label as the primary dimension to see details about each variation.
Creating reports to view Dynamic Yield data
Google Analytics 4
You can set up custom reports in Google Analytics 4 by creating an exploration. For example, you might want to set up a free-form exploration as follows:
- Open Explore and select Free form from the template gallery.
- Create a segment to isolate users who have seen a specific variation. For example, include users who trigger the dy_variation_impression event, where the custom dimensions you created correspond to a variation you are interested in. Click Save and Apply. Repeat for other variations.
- Apply the segments you just created to the visualization, and add metrics and any additional dimensions.
Google Analytics Universal
You can also set up custom reports in Google Analytics account under Customization:
- Add a filter including: Event Category or Event Action, or Event Label and search for any Dynamic Yield event such as DY Smart Action:
- You can add metrics, as many as required, such as ‘Bounce Rate’, or ‘Exit Rate’. This enables you to view the variation data breakdown in your Google Analytics account alongside any additional metrics you've included.
- You can also create segments with the condition of any Dynamic Yield event. This enables you to view and break down the data on the fly.