Use Google Analytics for Dynamic Content Tracking 2019-08-05T18:04:02+02:00

Use Google Analytics for Dynamic Content Tracking

This easy-to-follow guide reveals how to use Google Analytics to showcase the way users engage with your website when viewing dynamic content.

Your results will look like this:

Analytics report - dynamic content

Personalized content is great. With little effort, it increases conversion and engagement rates and can decrease bounce rates drastically. In this guide, we are going to show you an easy way to monitor the effectiveness of your dynamic content using Google Analytics.

There are a pair of steps involved in the set-up process:

Step #1: Creating event tracking when a dynamic version is displayed on a user screen.
Step #2:  Divide reports on Google Analytics to differentiate users who have viewed each with dynamic version.

Let’s Get Started!

STEP #1: Creating event tracking when a dynamic version is displayed on a user screen.

We are going to create a Google Analytics event each time a dynamic version is displayed. There are multiple ways to achieve this, the easiest one, and the one we will use in this guide is using Google Tag Manager. To create the event, we will enclose each dynamic version with a div containing an ID and Class. From there, we will set Google Tag Manager to produce an event each time a div with the Class is seen on a user’s browser. The event name on our Analytics reports will be automatically classified based on the ID of the div.

In our example, we the class will be named “ifsoEvent”, while the IDs will be known as “versionA,” “VersionB,” etc. and the IDs “versionA”, “VersionB,” etc. You can use any type of name, but be mindful that these IDs are what will be shown on your Analytics reports (representing the version name).

an example of a div with a class and id. Google tag manager will create a event based on the class and will name the event based on the ID.

Adding Class and ID to the content’s versions

  1. On your WordPress dashboard, go to If-So > Triggers and select the trigger you want to add tracking to
  2. Change the content field to HTML mode
  3. Assign a class of ifsoEvent to the content’s wrapping element. An event will be tracked with Analytics each time an element marked with this class is seen in the viewport of the browser.
  4. Assign an ID to the wrapping element – on the Analytics reports, whatever name you use is what will be shown as the version name.


You can copy and paste the following code, just make sure to replace “your content” with your own content.

<div class="ifsoEvent" id="versionA">Your content</div>

This is an example showcasing how it should appear:


Using Google Tag Manager for event tracking setup

There are a couple of parts involved in the Google Tag Manager setup process: 1) tag creation (to define the data sent to Google Analytics), as well as 2) trigger creation to select when the data will be transferred).

Tag creation

  1. Go to your Google Tag Manager dashboard
  2. Navigate to Tags.
  3. Click New and name the tag “If-So tracking” (3. The name is for your own convenience; you can choose a different name if you want).
  4. Click Tag configurations
  5. Select Google Analytics – Universal Analytics as the tag type and set up the event parameters as follows:
    – Track type: Event
    – Category: ifso_tracking (you can choose a different name if you want to)
    – Action: view
    – Label: Click the ‘+’ sign and select {{Click ID}}.
    – Non-interaction hit: TrueYour tag should look like this:
    – Under Google Analytics settings select {{Google Analytics settings}}

Trigger creation

  1. Click the triggering box.
  2. Click the ‘+’ sign and name your trigger (we named ours ‘ifso_tracking’. You can choose a different name if you want; it’s for your own use only).
  3. Click Trigger Configuration.
  4. Choose Element Visibility as the trigger type.
  5. On the selection method field, select “CSS Selector”.
  6. 6. On the element selector field, type the class you have chosen for your element (We did it in the first step of this guide. In our example, we assigned the class “.ifsoEvent”). Make sure to write the class name with a dot at the beginning.
  7. Save! You should now hit the save button 3 times: on the trigger configurations window, the trigger container, and the tag window
  8. Click the submit button

Be mindful that modifications in the Google Tag Manager are added once the ‘Submit’ button is clicked!

That’s it! If the instructions above were followed correctly, the events will be seen in your Google Analytics reports.

Step 2 – Segment reports on Google Analytics to differentiate users who have viewed the dynamic version.

Once the instructions listed above have been followed, events of various names will be assembled each time a dynamic version is shown. The events label is established by the version ID assigned to it from this guide’s first step. The only remaining step is to divide your Analytics reports for the sake of segmenting the assembled data as per the version seen by the user.

Separate users by the content version they see:

  1. On your Google Analytics account, go to the section you want to examine ( for example Behavior → Site Content → All Pages).
  2. On top of the Google Analytics, click +Add Segment.
  3. Click + New segment.
  4. Name the segment. For example, we named ours “versionA” but you can choose any other name; it’s for your own use only.
  5. At the side menu, click Conditions.
  6. Set up a filter as follows:
    – In the first drop-down menu, choose event label.
    – In the second, select exactly matches.
    – In the type-form, insert the version ID (in our example – “versionA”).
  7. Click Save
  • Was this Helpful ?
  • YesNo

Ready to get started?

See it working on your website! Try it free.