Tracking file downloads in Google Analytics AND Google Adwords
source link: https://blog.vermorel.com/journal/2007/11/16/tracking-file-downloads-in-google-analytics-and-google-adwor.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Tracking file downloads in Google Analytics AND Google Adwords
sysadmin
Google has not one web analytics system, but two of them, namely Google Analytics and Google Adwords. For the average webmaster, this situation is quite a pain, because most of the tracking code must be duplicated. To make the situation worse, Google Adwords does not support any straightforward solution to track file downloads.
For the sake of my own μISV, I have designed the following script that enables both Analytics and Adwords tracking in a single function.
// Tracking.js - Joannes Vermorel, Lokad.com, 2007
function dhtmlLoadScript(url)
{
var e = document.createElement(“script”);
e.src = url;
e.type="text/javascript”;
document.getElementsByTagName(“head”)[0].appendChild(e);
}
function lokadTracker(path)
{
urchinTracker(path);
google_conversion_id = 10683XXXX; // use your own ID here
google_conversion_language = “en_US”;
google_conversion_format = “1”;
google_conversion_color = “FFFFFF”;
if (1) {
google_conversion_value = 1;
}
google_conversion_label = “pageview”;
dhtmlLoadScript(‘http://www.googleadservices.com/pagead/conversion.js');
}
In order to track a file download just embed the script here above, and intercept the onclick event of your download link
Reader Comments (3)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK