Custom Conversion Rate Monitoring System for Google Analytics

What are custom alerts?

One of the most important functionalities of Google Analytics is custom alerts that we can configure at the view level. Alerts let you monitor traffic on your site and receive notifications when something unusual happens to traffic. Two of the basic parameters that you should be monitoring using alerts is the number of sessions and conversion rate.

Thanks to alerts we are able to monitor sudden decreases or sudden increases in the number of sessions, which allows you to quickly detect when something unusual is happening. For example, someone mistakenly deleted the Google Analytics tracking code, resulting in a drop in the number of sessions to zero.

Another metric worth monitoring is the conversion rate. Depending on the situation you may want to monitor the conversion rate at the level of individual product brands. Unfortunately, Google Analytics does not allow to set alerts at the level of individual product brands. The only available dimensions we can use are shown below in the screenshot.

This was the case we have encountered with one of our clients are we were happy to help them by developing our own conversion rate monitoring system using a few free tools.

Custom Alerts Monitoring System Components

In order to build our own system to monitor the conversion rate for product brands, we can use several tools that are made freely available by Google.

Of course, the first tool is Google Analytics, which allows us to collect data on product brands. To this end, we must have the Enhanced Ecommerce module implemented. Google Analytics provides an API that we will use to download data from Google Analytics regarding the number of purchases of specific product brands and the number of sessions.

The second element of our own conversion rate monitoring system will be Google Sheets. We will download data on product brands and sessions, as well as conversion rates to the spreadsheet using the Google Analytics API.

The third element included in the system will be the Google Apps Scripts platform, which is an integral element of Google Sheets and has an integrated Google Analytics API. This allows you to speed up the process of creating the entire system.

The last element included in the system is the GMail API, which will allow you to send email notifications.

Custom Alerts Monitoring System Rules and principles

In this section, we will discuss the inside-outs of our monitoring system.

  1. The first part is using Google App Scripts and Google Analytics API, to extract data on the number of sessions and the number of unique purchases of individual product brands.
  2. Then, using the Google Sheets API, we add this data to the spreadsheet, which is our data warehouse.
  3. Next, we run a script to check if the conversion rate for a given brand of products has fallen below a certain level compared to the previous period. In terms of timeframe, we use last week’s data compared to the previous week and the same week last year. Thanks to this, we are able to monitor the conversion rate at the product brand level on a weekly basis.
  4. Next, for those product brands for which we have seen a decrease in the conversion rate, using the script and the GMail API, we send email notifications to the stakeholders.

The Google Apps Script platform has a built-in trigger system that allows you to automate the process of refreshing data and checking the conversion rate and sending notifications. The whole process of creating the system and setting triggers will be presented later in the article.

Construction of the System Step by Step

Step one – customize the monitoring file

Make a copy of the file below first. The entire conversion rate monitoring system for product brands is based on this document.

[MTR] [CONTENT] – CR Monitoring System

The file consists of two tabs. The ‘MAIN’ tab has your report with a table that will contain data. In the second tab you will find the report settings. There you will find a place to enter the ID of the Google Analytics data view from which you want to download data on product brands.

The MAIN tab consists of three sections. The first one contains several informational statistics: the time of the last data refresh and the time range for which data is downloaded. In our case, it’s always the last two weeks. At the very end is the CR Threshold field. This is the place where we can specify the threshold for the conversion rate drop.

In a situation where the conversion rate for a particular product brand has fallen below the value specified in this field, we will receive email notification of such a situation.

The third element of the tab is the place where we can specify the recipients of notifications about a decrease in the conversion rate.

In the second tab named ‘Configuration’, you will find a place where you should enter the ID number of the Google Analytics data view. You can find this number by going to the settings of the given data view in Google Analytics.

Step two – script editor

The next step to set up your system is to go to the script editor. To do this, select the Tools option and then Script Editor from the top menu. We will move to the Google Apps Script platform, in which the entire conversion rate monitoring system has been created. You don’t have to change anything here. However, if you want to customize the script to your needs, feel free.

If you find any errors or want to add some improvements – you can also let us know! We will be pleased to receive feedback 🙂

The scripts collect data on the number of sessions and the number of unique purchases of individual product brands in an appropriate way and perform the appropriate conversion rate calculations. Then it checks if it has fallen below the level we specified. If so, then the script will send notifications to the e-mail addresses provided by us about the decrease in the conversion rate.

Step three – setting the appropriate triggers

The final stage is setting the appropriate triggers responsible for refreshing the data and checking the conversion rate.

To do this, click the clock icon in the script editor. We will be moved to a panel where we can set triggers for our project.

We will see a panel in which a trigger can be added in the lower right corner.

For the needs of our system, we must create two triggers.

Setting the first trigger – downloading data from Google Analytics

The first will be used to run a script that retrieves data from Google Analytics, performs appropriate calculations and inserts data into a spreadsheet.

1.First, click the Add Trigger button in the bottom right corner of the screen.

2. Then configure the appropriate parameters of our trigger.

  1. As the function we want to trigger, we choose the “runReport” function.
  2. We choose the source of the event, in our case it is “Time-driven“, which will allow us to set the trigger for a specific day and time.
  3. We choose how often the script should be run. Because in this case, we want to monitor the conversion rate of the last two weeks, we check weekly for any significant changes. To do this, we select “Week timer” as the trigger type
  4. In the next step, we determine on which day the script is to be run, for us it is Monday
  5. At the very end we set the hours. We want the data in the report to be refreshed in the morning between 5 and 6 am. In addition, you can specify when notifications about any trigger errors should be received. It is best to set Notify me immediately. You will then be able to react relatively quickly when data refreshing has failed.
  6. Finally, click Save. At this point you will be asked to authorize the script. Remember that the script must be authorized from the same Google Account in which you have access to Google Analytics from which you want to download data. Otherwise, the system will not be able to download data from the appropriate Google Analytics account.

Second trigger setting – checking conversion rate and sending notifications

The second trigger we need to set is the script trigger responsible for checking the conversion rate and sending email notifications. The following screen capture shows the trigger configuration.

The only changes compared to the previous trigger are:

  1. The function we want to trigger. In this case it is the “checkConversionRates” function.
  2. The time when we want to trigger our script. In our case, it is the time after refreshing the data in the report, i.e. between 6 and 7 am. After clicking save, you will also be asked to authorize the script.

After setting and saving the triggers, the entire system is set up and ready for operation.

Summary

By using free tools provided by Google, we are able to create our own conversion rate monitoring system in a very simple way. 

The system retrieves the data needed to calculate the conversion rate for product brands using the Google Analytics API. It also allows you to check whether this ratio has fallen below the level we have determined.

Thanks to the Google Apps Script platform, Google Analytics API and other mentioned tools, we can expand the possibilities of both Google Analytics and Google Sheets.

Trigger functions built into the Google Apps Script platform allow you to automate the entire process of checking conversion rate and receiving relevant notifications.

We are Experts in Reporting

If you are interested in other tailor-made reporting solutions or would like to automate your internal reporting processes, write to us using the contact form and we will help you build the right solution for your needs.

Share on facebook
Share on twitter
Share on linkedin