Set up (web)
Download Links (PDF, AVI, WMV)
To track clicks on links that lead to files such as PDF documents, you can modify the HTML for the link in one of two ways:
- Using a virtual pageview
With the virtual pageview, you use the
_trackPageview()function to assign a path/page name to the link. This method is useful if you want to create virtual directory structures for your download files and if you do not mind that clicks on these links add to the overall pageview count for your site. When you configure download links like this, any goal that you set for such links must be URL Destination goals. See Goals for URLs and E-commerce for more information. For code examples, see Virtual Pageviews in the Asynchronous Migration Examples guide, which shows how to use
_trackPageview()in all versions of the tracking code.
- Using Event Tracking
With Event Tracking, you use the
_trackEvent()function to set up categories, actions and labels for the download file that you want to track. With event tracking, clicks to links will not count towards the overall pageview count for your site. In addition, you will get the benefit of being able to configure 3 possible segments for the link (category, action and label). For more information, see Event Tracking. To create goals for these types of links, you would use Event goals. See Setting Up Goals for more information.