Tracking Sitecore Campaign Activities in GA
Should you track your marketing campaigns in Sitecore? Are you hesitating because you already use Google Analytics (GA) to evaluate the performance of your campaigns?
The answer to my first question is a definite yes. Besides the typical performance analysis, tracking campaigns in Sitecore feeds the platform with very valuable data to fuel your optimization strategies. Being able to leverage how your visitors landed on your site to personalize their experience, and continue the dialog between brand and customer at an individual level is indeed worthy.
The answer to my second question could be Oshyn's Sitecore module to ease the load of having to configure tags in multiple places.
In previous posts, I presented you with this module and explained the steps to push your campaign data to GA using Google Tag Manager (GTM).
One of the steps described in my second post consisted of creating a data layer variable to capture the “Sitecore Campaign Activity Name“. The goal is to have a way of comparing numbers between the two platforms.
Since we are mapping our Sitecore Campaign Group to the utm_campaign parameter there is no correlation between the campaign activity and the campaigns tracked in GA. The solution is simple: we just need to keep track of the Sitecore campaign activities in GA as well. Keep on reading to learn how...
To expose Sitecore Campaign Activity Name as a Custom Dimension in your GA hits, you’ll need:
Hit-scoped Custom Dimension, to collect the Campaign Activity Name in Google Analytics
Data Layer Variable, which picks up the Campaign Activity Name from the data layer
Modified Tag, to which you want the Campaign Activity Name to be attached
Step 1: Add Custom Dimensions on GA
On GA Admin go to the property section → Custom Definitions → Custom Dimensions.
Add 1 new custom dimension named Sitecore Campaign Activity with Session Scope.
New GA custom dimension
The result will be something like this:
GA custom dimensions
GA assigns Index numbers automatically to all Custom Dimensions. We will use the Index number later for referencing the Custom Dimension on GTM.
Step 2: Add Variables on GTM
If you followed all of the steps in my previous post in this series, you might have created this variable already. If not, just create a data layer variable in GTM. It will be used for retrieving the Sitecore campaign activity name (scCampaignName) from the data layer.
GTM Datalayer Variable
Step 3: Modify Google Analytics Settings variable
I'll use the same Google Analytics Settings variable previously created to map the ID data layer variable to the GA custom dimension.
Expand the Custom Dimensions section on the GTM variable.
On the Index, put the same index number that the GA custom dimension for Sitecore Campaign ID has and on Dimension Value pick the ID variable.
Done, now you can publish your changes and test the new dimension on GA reports.
Keep in mind that GA reports are refreshed only once a day. The new dimension will not apply to previous data. So you must wait until running your next campaign to see the results.
GA settings variable configuration for custom dimensions
I have created an example campaign group named Symposium with two online campaign activities. One that took place via “Email newsletter”, and another one set as “Twitter social community”.
Sitecore campaign activities in Symposium group
I visited the pages of my demo site associated with those activities one time. My interaction with the campaign activities landing pages was recorded in Sitecore. It's visible in the Experience Analytics “Campaigns” report under the Acquisition tab.
Experience Analytics Campaigns report
My visit to the two landing pages is also recorded in GA. I'm able to see the data that relates to my two visits in the “All Campaigns” report under Acquisition → Campaigns.
GA All Campaigns report
To compare my data side by side I open the “All Campaigns” report in GA. Then click on the campaign I want to check (Symposium) and add the Sitecore Campaign ID as a secondary dimension In Sitecore, I click on the Symposium campaign group to drill down the report.
GA custom dimension Sitecore Campaign Activity
As end result, all the elements defined in my Sitecore campaign configuration are now available in GA I can drill down my GA reports using dimensions like campaign activity, channel, source and medium.
GA campaign with Sitecore Campaign Activity custom dimension on
In Sitecore, I will use my campaign data to personalize my visitors' experience on the site.
Sitecore Experience Analytics Campaign Group reports