Google Analytics Absolute Conversion

By artyv Last update Mar 4, 2009 — Installed 505 times. Daily Installs: 0, 0, 1, 3, 0, 0, 1, 0, 0, 0, 2, 0, 4, 3, 6, 0, 0, 0, 2, 4, 0, 0, 0, 2, 1, 1, 3, 2, 0, 0, 0, 0

There are 1 previous version of this script.

// ==UserScript==
// @name           Google Analytics Absolute Conversion
// @namespace      http://artyv.ru
// @version        2.1
// @description    Converts percent values to absolute values in tables
// @include        https://google.com/analytics/reporting/*
// @include        https://*.google.com/analytics/reporting/*
// @exclude        https://google.com/analytics/reporting/top_content*
// @exclude        https://*.google.com/analytics/reporting/top_content*
// @exclude        https://google.com/analytics/reporting/content_titles*
// @exclude        https://*.google.com/analytics/reporting/content_titles*
// @exclude        https://google.com/analytics/reporting/content_drilldown*
// @exclude        https://*.google.com/analytics/reporting/content_drilldown*
// ==/UserScript==

function calcAbs() {
	var statTableRows = document.getElementById('f_table_data').rows;
	for(var i = 1; i < statTableRows.length; i++) {
		if (statTableRows[i].className.indexOf('comparison_values') > -1) continue;
		var rowCells = statTableRows[i].cells;
		var absoluteSource = rowCells[2].textContent.replace(/[^\d]/g, '');
		for(var j = 3; j < rowCells.length; j++) {
			var percentSource = rowCells[j].textContent.replace(/\s/g, '');
			if (percentSource[percentSource.length - 1] == '%') {
				percentSource = parseFloat(percentSource.replace('%', '').replace(',', '.'));
				rowCells[j].innerHTML += '(' + Math.round((absoluteSource / 100) * percentSource) + ')';
			}
		}
	}
}

if(document.getElementById('f_table_data')) {
	calcAbs();
	document.getElementById('Table').addEventListener('DOMSubtreeModified', calcAbs, false);
}