Google Analytics offers two ways to access its data: 1) the out-of-the-box method (web interface) and 2) the “custom” method (API). The web interface (analytics.google.com) is quick and easy but limited to standard aggregations. The API requires a higher degree of technical knowledge but affords users with many more options and overall flexibility.
How do you know which one you need? Go to the API when you “hit a wall” with the web interface.
Do you need one of the items below?
- Custom dashboards w/ either historical or point-in-time reporting
- Automating complex aggregations and reporting
- Integrating and synchronizing the in-depth analytics data with other business datasets for advanced decision making.
If so, you won’t find a way to do it in the web interface. Congratulations! You’ve graduated to the API.
The good news is that the Google Analytics API library is detailed and well-documented. It is one of the best APIs available in the technology world. With a little research and a reasonable investment of your time, you will be able to satisfy the advanced requirements mentioned above and dig out the big insights hiding within your Google Analytics data.
Please note: An application programming interface (API) is a compilation of platform independent web-based options imported as a piece of software intermediary that allows two applications to talk to each other. APIs extensively help reduce the effort of writing a large amount of code to implement certain complex data fetch requirements
Google Analytics API Best Practices
The following API requests are submitted (A few API response datasets are displayed here as examples) to produce satisfactory results for the business:
Ensure the cleanliness of the analytics data. Do this by comparing the API results to fields that exist in the web interface. The example below ensures this by validating the same field (page counts). The field passes our test when/if the page count value agrees between the API output and the web interface results. At a minimum, major KPIs (page counts, page view, etc.) should tie from one source to the other.
A sample representation of the ‘Page Views’ may look like the following:
Several Customized views (such as Master view; Test views or no-filter view) may be created applying different slices of the datasets. To achieve the same, different sets of user defined filters, goals, etc. need to be applied in tracking/producing the same.
As discussed earlier, pageview report is an important metric to track and should be cross referenced with an out of the box real-time report available in the Web interface to validate the correctness of the dataset.
All traffic generated internally (i.e. traffic from testing, from employees or developers etc.) needs to be filtered out to have correct master pageviews. We also need to exclude the query parameters for the same reason.
Along with ensuring the data quality of the datasets defined above, we also need to ensure the attribution information (tracking the Traffic source) it accurately enables the information, such as, “where the traffics are flowing from”. Few of such essential entablements are “Organic Search”, “Paid Search”, “Facebook Paid ads”, “Yext”, etc.
Google Analytics API: Common Mistakes (and How to Avoid Them)
- The pages, if tagged incorrectly, will produce insufficient data collection issues leading to incorrect data alignments.
- Measuring more than a single domain in the same ecosystem needs extra code to achieve the right goal. If the implementation is improper, self domains may lead to disagreement between result sets.
- While applying filters, conditions in the API calls, in-depth analysis need to be done carefully, especially when applying “exclude” and “include’ filters at the same time. It is worth noting that the filters are only processed sequentially.
- We need to evaluate setting up user access while configuring the access level to add and change settings in the account.
- Though the low Bounce Rate and high Conversion Rate is desirable, but there is a definite risk that need to be carefully and logically reasoned/analyzed if the Bounce Rate drops under 15 to 20%. Potentially the issue is that the tracking code may be getting executed more than 1 time.
- Tracking Codes passed to the API may yield erroneous/undesired results due to wrongly formatted Tracking Code as that may be with a Space within producing wrong results.
- It is advisable to use data for trends and optimize accordingly, reported out of APIs, but should refrain from using the API for exact number reporting, such as Sales Revenue, instead we should use the back-end data while reporting on exact sales numbers.
- It is a best practice to use UTM campaign tracking only for measuring the effect of external campaigns, but we should avoid tracking the performance of an internal campaign. Instead, we could use event tracking or site search to track the effectiveness of internal campaigns instead.
- A special consideration should be given to use confidence intervals or at least a large pool of data before drawing quick conclusions about which ad or page is performing better. Otherwise, a wrong decision is arrived by drawing the conclusions too quickly.
- It is extremely important to evaluate the data sampling strategy. Depending on the analytics the data sample size to be determined. For example, we should consider gathering an appreciably large data sample for the prediction of the behavior of all visits.
Success with the Google Analytics API: Lessons from a Consultant
Aspirent established an automated process to extract API data and took over primary responsibility of feeding the data to Tableau dashboarding for a client’s marketing division.
- Architected a new Azure cloud instance for Marketing data, merging multiple sources (Google, Facebook, Bing, etc.) to capture insights on sight traffic, customer sentiment, and convert leads.
- Refined the data into actionable insights, applying business rules to generate conversion data accurately and reliably.
- Developed Tableau dashboards to drive action at the Franchise level, communicating basic statistics as well as results generated from advanced data science models.
- Produced a Reporting solution delivering the reports to > 450 recipients each month.
- Enabled client to drive 22% growth in digital inquiries and an average location occupancy of 85%, both are huge improvements over baseline. The results are achieved through easier use of extracted API data.
- Enabled the client to Oversee end-to-end management of all digital marketing channels, paid/organic search marketing, programmatic media, social media, SEO, and website marketing strategy with the goal of driving qualified conversions.
- Enabled client to effectively analyze and optimize both front and back-end campaign performance, executing changes based on quantitative, actionable insights.
Prabir Bhattacharyya – Manager, Cloud Solution Architecture