Omnibug – Part 2 :: Analysing Adobe Analytics hits

In part 1 of this Omnibug series we looked at filtering web analytics hits that are detected by Omnibug and exporting this data into a csv (or tsv) format for further analysis or record keeping.

This post will run through creating an easy way to inspect multiple web analytics hits using Google Sheets.

Omnibug is a great tool for inspecting information in web analytics hits. However there are some use cases where having a slightly different way of viewing the data would be much more useful.

One such case is when there are many hits, and you want to see when a certain event occurs or when a particular dimension changes its value. Trying to use the Omnibug interface in Developer tools to perform this kind of task is long, tedious and error prone as it requires you to inspect each hit individually.

The process below shows how you can parse out the dimensions in an Adobe Analytics hit from an Omnibug export using Google Sheets and some Google Apps Script.

Step 1 – export csv

Export the Omnibug findings in a csv format.

The data in the csv file will follow the below format.

Step 2 – open csv file in Google sheets and add apps script code

Load the downloaded Omnibug extract to Google Drive and open the file using Google Sheets.

Once the file is open in Google Sheets, open the “Extensions” menu and select “apps script” to open the Google Apps Script editor.

Paste the below code into the editor and save it. The “EXTRACT_PARAMETER” function will now be able to use from within the Google Sheet.

/**
 * Extracts the values passed through as variables from an Adobe request url.
 * Eg EXTRACT_PARAMETER("c1", request_url) returns the value passed into prop1
 * Eg EXTRACT_PARAMETER("v3", request_url) returns the value passed into eVar3
 *
 * @param {search_parameter} the variable name in the request url to extract.
 * @param {input} an adobe request url.
 * @return The value of the variable given.
 * @customfunction
 */

function EXTRACT_PARAMETER(search_parameter, input) {
  // seperate string into array of key value pairs
  var myPairs = decodeURIComponent(input).split('&');

  Logger.log(myPairs)

  for (var pair in myPairs){
    // split key value pair
    //Logger.log(pair);
    var newArray = myPairs[pair].split('=');
    Logger.log(newArray);
    Logger.log(newArray[0]);
    //Logger.log(newArray.indexOf(search_parameter));
    if (newArray[0] == search_parameter) {
      Logger.log(newArray[1]);
      return newArray[1];
    }
  }
  //return myPairs;
}

Step 3a – Identify the key value pairs to extract

While Omnibug shows the key value pairs in a presentable format, the keys are not actually the ones present in the raw data.

In the below screenshot, Omnibug shows the ‘prop1’ key as having the value ‘Woolworths’

However in the raw data we can see that the actual key for the value ‘Woolworths’ is ‘c1’. The developers of Omnibug know that the key ‘c1’ maps to prop1 within the Adobe Analytics universe and have just applied the more user friendly name for users convenence.

Here is a screenshot of the data as it is captured in the Network tab of the developer tools

To easily parse the key value pairs in the Adobe Analytics payload the Adobe Call Formatter tool can be used.

The payload will be in one of the “Request URL” or “POST data” fields (columns E or F) in the extracted csv from Omnibug.

Step 3b – extract all the values

Now that the parsing function is available and the key values to pull out known, the parsing function can be used.

The function in Google Sheets only takes 2 parameters

=EXTRACT_PARAMETER('key_value', 'adobe_analytics_payload')

‘key_value’ is the name of the key for which the value will be extracted and displayed

‘adobe_analytics_payload’ is the long string of data that gets passed to Adobe Analytics

In the example walkthrough, the following is the formula used in cell J4 to extract the url for the first adobe analytics payload:

=EXTRACT_PARAMETER("g", concat(E4,F4))

In the above formula the concat function is used because the payload can appear in either the Request URL or POST Data fields, so passing the concatenation of the two fields ensures the adobe analytics payload is always passed to the function (when the formula is applied to other rows of data

The data is now nicely formatted to be able to scanned to identify when a value begins to have data passed or changes.

Send a Comment

Your email address will not be published.