Bringing context to the data
To get more valuable insights from your data, you'll have to add context. This way we can bring more emotion and intent into our Analytics data.
Intent you say?
In Marketing Automation tools like HubSpot, you can build internal logic to segment leads in marketing persona's or add them into a customer lifecycle stage.
Using smart blocks in HubSpot, you have the power to transfer this internal logic into your Analytics data to have more context in your Analytics reports and detect patterns in your visitor data.
This step-by-step guide will show how you can use the built-in contextual blocks to enrich your Analytics data.
- HubSpot Pro account
- Universal Analytics account
- Google Tag Manager in place
Step 1: Create a smart block within your HubSpot design template
We added this smart block in the header template to get the smart block loaded on every HubSpot page of the account.
Step 2: Configure your Smart Block
Choose the internal logic you want to use, based on which smarter segments you need in Google Analytics.
This feature detects the visitor and matches his account using an existing HubSpot cookie in the visitor's browser.
Step 3: Add Smart Rules
Configure your HubSpot smart block and add the Datalayer-push code, basing the value on the Smart Rule.
window.dataLayer = window.dataLayer || ;
Check this blogpost from Simo Ahava about the push() method with GTM.
Step 4: Create a Custom Dimension in Google Analytics
Remember the ID from the Custom Dimension you've created.
Step 5: Create a new variable within GTM
In Google Tag Manager, you'll have to create a new "Data Layer Variable"that will read the previously created HubSpot Data Layer.
Step 6: Create your GTM tag to fill the Custom Dimension in Google Analytics
Change your existing GTM Universal Analytics tag and match the Custom Dimension (remember the index number from step 4) with the previously created GTM variable.
Step 7: Change the tag trigger
HubSpot smart blocks will add the data layer code below your existing GTM snippet.
Because of this fact, you'll have to change the tag trigger in order to have it wait until the DOM is ready.
Step 8: Test and publish
Using the GTM Preview mode, you can test the existence of the HubSpot data Layer and whether GTM is capturing this value.
Remember: Data is nothing without Context
Every company has its own goals and processes. The marketing technology landscape is becoming more and more complex with new tools popping up every week.
You'll get the most possible return from these tools if you combine data to get more context.