Unire i dati di Analytics con la CDP ed analizzarli con Data Studio
Esplorare i propri dati rende le attività di marketing estremamente redditizie e semplici, oltre che monetizzare la customer base in maniera più scientifica.
Articolo in italiano

In this article, I will show you how to merge data from different sources, using information provided by Google Analytics and merging them in Google Data Studio.

Google Analytics Settings

Let's start with the first Google product! Open the e-commerce analytics and clicking on administration link, at the bottom left of the side menu. Then in the central column, looking for the link "Custom definitions / Custom sizes".

We are going to create custom dimensions that will allow us to merge data in Data Studio through a conjunction key.

By clicking on "+ New Custom Size", we're going to create a new dimension, as shown below:

This dimension will allow us to identify each user using the association with an unique ID, generated by a custom function that we will create shortly.

How to associate CRM or CDP data to Google Analytics

In order to associate the data of our CRM or CDP (Customer Data Platform) we must create an additional customized dimension, following the same previous steps, identifying it, this time, with UserID.

Adding a Customer ID of a CRM or the customer's email, it will allow us to explor and going deep in our data thanks enhriched by some other external sources too! Oh, I was forgetting, you could create some interesting personalized reports in GA too, using this dimension...

Easily now, we're going to use email, which can be intercepted when a user:

  • subscribe to the newsletter;
  • make a purchase;
  • start a conversation via live chat or chatbot;
  • when logging in or registering.

Adding value to custom dimension via javascript

Just embed this following javascript to be able to send the value, to the custom dimension, we created before:

ga('set', 'dimension2', UserIDValue);

Adding value to ClientID and UserID in Shopify

With the following function it'll be possible to add to ClientId a random value and Shopify Customer ID to the UserID.

ga(function(tracker) {
    var clientId = "GA" + String(tracker.get("clientId"));
    ga("set", "dimension1", clientId);

    if (__st["cid"]) {
        ga("set", "dimension2", "shopify" + String(__st["cid"]));
    }
});

Tag Manager

For those unfamiliar with the advantages of this powerful tool, here is an excerpt from the official website:

"Google Tag Manager is a tag management system (TMS) that allows you to quickly and easily update measurement codes and related code fragments collectively known as tags on your website or mobile app. Once the small segment of Tag Manager code has been added to your project, you can safely and easily deploy analytics and measurement tag configurations from a web-based user interface."
Link to the page

Adding value to the first custom dimension: ClientID

Opening our "Default Workspace", select "Variables" from the side menu, as follows:

Scrolling down the page, where are situated the user variables, and click on "New" to create one.

Then select "Javascript variable" as "Variable Type" and insert the code that will allow us to randomly create a UserID for the each user browsing our site.

Custom function for creating a random User ID
An aspect that should not be underestimated is the retention of user data and the cookie expiration time which you can find in "Monitoring Information / Data Retention" in Google Analytics Settings.

A valid alternative to create variables using Google Analytics is Tag Manager, as shown follows:

Now all we have to do is adding a value to the variable when we deem it most appropriate, using the following script at the time of its valorization:

dataLayer.push({'UserID': '## Il tuo User ID o Email ##'});

Google Analytics Advanced Settings in Tag Manager

For those who have never configured Google Analytics through Tag Manager, I refer to the official guide that explains very well how to do it.

By opening the Google Analytics tag we must go to value dimension1 (in my case) with a random value generated by the function we created previously.

Let's set the "Other Settings" in the tag as follows.

Congratulations!

Now you have set a unique ID for each user and associated the email of your customers to users recognized by Google Analytics.

Visualize data in Data Studio

Opening Data Studio, click on "New / Report" and from the top menu select "Add Data", which will open a modal with the possibility of integrating many other sources.

Select Google Analytics and proceed by selecting the e-commerce data we want to merge.

Always clicking on "Add Data", we are going to integrate our new data source which could be in Google Big Query, from a MySql database, Google Sheet or from other 280 connectors.

In this example, I used a data export from a Google Sheet, where I previously calculated the RFM matrix, whose union key will be the customer email.

Just drag-and-drop the respective keys in order to then manipulate and view the data in the various formats that interest you most.

Here, I will get all information about my customers insights from Google Analytics data and from my own sources. I can exploding the data of origin and acquisition, the interests of the devices they use, associating this data to the RFM analysis that provides me information related to their spending potential.

You can get more complex integrations, creating a real command console of your business! I will explain this in the next article that will also cover the Marketing Data Cycle.

Sign up to the newsletter, to stay tuned!