Phatmat
27 Apr 2008, 10:38 AM
I have just signed up with Google Analytics, and have a question about tracking direct download links. On my site, users will click "Download" and be presented with a direct URL linked to the download, so they wont view any pages before beginning the download. I need to be able to track what files get downloaded.
Google Analytics claims to be able to do this, though here is what it says. My problem is just the html coding, as I am not too used to it.
Google Analytics FAQ:
---------------
Tracking Downloaded Files:
Track downloaded files and get valuable metrics for them
Know when key files are downloaded from your site. To
create an entry in Google Analytics reports for file
downloads, send a string beginning with a forward slash to
the _trackPageview() function.
Original Link Format:
<a href="mydoc.pdf" >Download a PDF</a>
Tracked Link Format:
<a href="mydoc.pdf"
onclick="pageTracker._trackPageview('/mydoc.pdf');">Download a PDF</a>
---------------
Though my problem is my "Original Link Format". Here is my original link format:
<a href="http://www.filehost.com/test.rar">
<img border="0" src="images/rardownloadbtn.gif" width="148" height="28"></a></p>
It is a picture with a hyper link, not just text.
Would anyone know how to get my link into the "Tracked Link Format"? I am not too sure whether I should have the '/' in the ('/mydoc.pdf'), since I have a download URL not file (it is a remote hosted file).
Any help would be great, thanks.
Matt.
Google Analytics claims to be able to do this, though here is what it says. My problem is just the html coding, as I am not too used to it.
Google Analytics FAQ:
---------------
Tracking Downloaded Files:
Track downloaded files and get valuable metrics for them
Know when key files are downloaded from your site. To
create an entry in Google Analytics reports for file
downloads, send a string beginning with a forward slash to
the _trackPageview() function.
Original Link Format:
<a href="mydoc.pdf" >Download a PDF</a>
Tracked Link Format:
<a href="mydoc.pdf"
onclick="pageTracker._trackPageview('/mydoc.pdf');">Download a PDF</a>
---------------
Though my problem is my "Original Link Format". Here is my original link format:
<a href="http://www.filehost.com/test.rar">
<img border="0" src="images/rardownloadbtn.gif" width="148" height="28"></a></p>
It is a picture with a hyper link, not just text.
Would anyone know how to get my link into the "Tracked Link Format"? I am not too sure whether I should have the '/' in the ('/mydoc.pdf'), since I have a download URL not file (it is a remote hosted file).
Any help would be great, thanks.
Matt.