Track Links to Files and External Websites

Most web tracking users know that you can track all the clicks on pages on the site running the web tracking technology. This is because each web page contains JavaScript that is run when each page is refreshed. However, with ClickDimensions, our JavaScript is smart enough to detect clicks on links to files on your site and even to external web sites and files hosted on external web sites. For example if you want to track a click to a document download of a PDF file, the technique described below will help! For setting up Web Tracking on the pages of your website, see this article.

NOTE: It is not necessary to go through this process to track files if they are hosted on the same domain that you are tracking via the ClickDimensions Tracking Script. A visitor accessing those files would automatically generate a Link-type Page view. 

Watch a Video on How to Track Documents and Links to External Sites

john video still frame

Written Instructions

This is very powerful from a marketing perspective. Consider a few scenarios:
  • You want to track all clicks from your site to a partner site
  • You want to create a landing page where clicking on a PDF file is considered a conversion (instead of completing a web form)
  • You want to track all clicks to links on your corporate overview PPT file or PDF data sheet
  • You want to automatically trigger an email to be sent to someone who downloaded a certain file or files on your web site
  • You want to track every time a visitor clicks on your link to a certain file; even if that file is not on your web site
Page View
We could go on but you probably get the point. So, how do you enable this? For links to files you only need to make sure that the link is absolute. In other words, the link must include the complete URL starting with the http part (the protocol). In these cases, our service tracks the full path of the file as the page view URL (see embedded graphic) and the anchor text (the actual link text you click on to get to the file) as the page title.
This works with any file type including PDF, Word, Excel, PowerPoint, graphics, anything. This also works for links on your site that go to files hosted on other sites. As long as the link on your site is absolute, we track it. For tracking clicks to links to external sites we provide you a custom 'onclick' parameter you can place in the href tags for links you want to track. In this parameter you can specify the URL as well as the link title.

The Code

<a onclick="cdAnalytics.trackLink('URL of Page to Display in CRM','Page Title to be displayed in CRM')" href="Actual URL to Go to When Link is Clicked">Text to Click</a>
Here is a working example:
<a onclick="cdAnalytics.trackLink('','Link to Tomato Sauce Recipe')" href="">Tomato Sauce Recipe</a>
The graphic below shows the custom onclick parameter inside the web page at The syntax is onclick="cdAnalytics.trackLink('','Link to')" where is the link that will show up as our page view URL and Link to is the text that will be listed as this page view's page title.
When all the links at are clicked in sequence, below is what you will see inside CRM. Starting at the bottom of the list you see the click on the page itself and then you see the clicks on the links to the PDF, Word, Excel, PowerPoint, ZIP, .png, and PDF hosted on
Page Views
We love these capabilities here at ClickDimensions because clicks on our 'how to' and deployment guides are real indicators that a prospect is seriously interested in our solution. We also like the idea of being able to know how many clicks from our site go to partner sites. There are countless ways to use this capability.
Have fun!
Have more questions? Submit a request


Article is closed for comments.