This article is produced by scandiweb

scandiweb is the most certified Adobe Commerce (Magento) team globally, being a long-term official Adobe partner specializing in Commerce in EMEA and the Americas. eCommerce has been our core expertise for 20+ years.

Bamboo Deployment Tracking to Production Environments in Google Analytics

Our current Google Analytics implementation does a fine job at 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:

  1. 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.
  2. 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.

Transport:

POST /collect HTTP/1.1

Host: www.google-analytics.com

Hit payload example:

v=1&t=event&tid=UA-xxxxxxx-x-&cid=16ab415d-9e30-4f54-9dcf-8afe71798697&dh=www.example.com&ec=Deployment%20to%20Production%
20environment&ea=SUCCESS%3A%20production-120&el=LFS-120%3B%20LFS-121%3B%20LFS-99&ds=bamboo&aip=1

Full HTTP POST request URL:

https://www.google-analytics.com/collect?v=1&t=event&tid=UA-xxxxxxx-x371920-1&cid=16ab415d-9e30-4f54-9dcf-8afe71798697&dh=www.example.com&ec=Deployment%20to%
20Production%20environment&ea=SUCCESS%3A%20production-120&el=LFS-120%3B%20LFS-121%3B%20LFS-99&ds=bamboo&aip=1

For more information, read the following:

Measurement Protocol Reference

Measurement Protocol

Bamboo variables

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 behavior tracking? Check out our analytics services or drop us a line at [email protected]. Alternatively, contact us right here within the orange chat bubble to your right.

Need help with your eCommerce?

Get in touch for a free consultation to discuss your business and explore how we can help.

Your request will be processed by

If you enjoyed this post, you may also like