Bamboo Deployment Tracking to Production Environments in Google Analytics
Our current Google Analytics implementation does a fine job of collecting and reporting both website performance and user behavior. However, it lacks a few key pieces of information about the process—the cost that goes into building a website and the business impact on-site changes.
Google Analytics reporting lacks the following:
- Easily available website releases on progress and return on investment
- Statistical history on improvements that generated a rise in sales or conversion rate
- A possibility to track metrics and see whether our release environments are stable enough for deployment
Ideally, a Google Analytics setup for measuring the success of a development process should include:
- Automatic notifications of new live site releases
- Additional information on releases for the purpose of driving actionable insight
To achieve that setup, we had to make sure that Google stays up-to-date with the content and timing of the release.
We also tried to add:
- Features sourced from Jira
- A comprehensible summary of the release purpose
- Release version number (in the case of success)
- An option to understand why deployment didn't go live (as a way to measure technical skills)
How to achieve the setup
With the help of Google Analytics Measurement Protocol, we were able to build and integrate a unique solution into our Bamboo deployment system.
This solution enabled the sending of data to Google Analytics on:
- The success or failure of deployment
- Deployment time and date
- Deployment release name (e.g. “production-120”)
- Release(s) containing Jira issue keys (e.g. KFS-120, LFS-121, etc.)
We achieved it by integrating an additional task into our Bamboo deployment job.
This task could:
- Retrieve needed dynamic variable values
- Place them in the GA Measurement Protocol Hit payload
- Send the Hit to Google Analytics by executing the HTTP request
There are 2 parts to send data to GA using the Measurement Protocol:
- The transport (where and how you send data). For instance, we had to use the HTTP requests to the https://www.google-analytics.com/collect end point as well as the POST request.
- The payload (the data you send). In other words, all data collected by GA using the Measurement Protocol is sent as a payload. The payload resembles a URL query string where each parameter has a key and a value, and is separated by an = character. Each pair is also delimited by an & character.
Please note that all values sent to Google Analytics must be both UTF-8 and URL Encoded.
The expected result
When a Bamboo deployment to the production environment has been triggered with available results, you should execute a Google Analytics Measurement Protocol HTTP POST request to pass all the specified values to GA.
POST /collect HTTP/1.1
Hit payload example:
Full HTTP POST request URL:
For more information, read the following:
Let us help you!
We hope you found our article useful! Have some additional questions or comments? Need a custom solution for your website tracking setup or help with extending the current user behaviour tracking? Check out our analytics services or drop us a line at email@example.com. Alternatively, contact us right here within the orange chat bubble to your right.