Getting Started With Google Analytics

Getting Started With Google Analytics

Getting Started with Google Analytics in Matillion ETL

When using any load component in Matillion, the first step is to understand the data to be extracted. In Matillion the Google Analytics Component pulls the data from one Google Analytics View. The View is the subset of data which from a particular website, app or point of sale system. The View connected to is controlled by the Profile in Matillion. To get the Profile Id, go to the Google Analytics console in your web browser and using the arrow in the top left hand side of the screen you can select the Account, Properties and Apps and Views you are connected to. The Profile Id is the number beneath the View name:

This should be set in the Connection Options in the Google Analytics Component in Matillion:

Today we want to look at the number of page views for each page in our website. This data is available in the SiteContent Data Source in the PagePath dimension and PageViews metric. To explore the data available in Google Analytics and how these map to the data sources in Matillion we recommend using this 3rd party tool.

Here we can see a list of the available metrics and dimensions in Google Analytics in the Query Parameters:

Using this we can view the sample results:

This translates into the below in Matillion:

We can see the data using a Table Input component in a Transformation Job by sampling the data:

The above query is giving us all page views for the last 30 days by default. To change the time period, we need to define a date range. This can be done by specifying a start and end date as a default filter in the Connection Options:

We now have a simple data set showing us the number of page views for each pagepath for a given time period. We can add further dimensions and metrics to this query to enhance the information:

This gives us the below results:

This can be replicated in Matillion by selecting the PageTitle and the AvgTimeOnPage in the Data Selection. However the UserType is not available to select. Instead this can be included in the query by using the extra dimensions field. To use this, it needs to be included in the query:

The Dimensions values also need to be set using the Default Filter Connection Option in Matillion:

We have seen how to simply create a connection into Google Analytics and how to start building queries to obtain the data required. Please note Google limits Google Analytics queries to a maximum of 7 dimensions and 10 metrics. To obtain more data than this, we recommend using a variable to filter and then looping through variable values. Variables could be populated from another Google Query if required.