How to create virtual page views?

Goals for Downloads


Because a link to a downloadable file is not actually a web page, your URL goal will not work correctly if you merely supply it with a download link. To track a download as a goal, you will first need to configure the download link in one of two ways:

If you configure the link as a virtual pageview, the overall pageview count for your website will be inflated by the number of clicks on that link, so for this reason we recommend using Event Tracking to configure download links. This section illustrates both methods.
    • Virtual URL Goal > To track the download link as a pageview count, assign a virtual URL to the download link on the web page. For example, the link to your download might look like:

      <a href="http://www.example.com/downloads/specSheet.pdf" onclick="_gaq.push(['_trackPageview', '/downloads/specSheet.pdf');">

      Once you create the virtual URL, you can supply that same URL as the value for the goal URL. For details on how to use virtual pageviews in your tracking code, see Virtual Pageviews in the Asynchronous Migration Examples guide, which shows examples for all versions of the tracking code.

    • Event Goal > To track the download link as an event, add an onClick event to the link that uses _trackEvent(). For example, the link to your download might look like:

      <a href="http://www.example.com/downloads/specSheet.pdf"onclick="_gaq.push(['_trackEvent', 'category', 'action', 'opt_label', opt_value]);">

      Once you modify the link, you can create an Event Goal in your profile with a category condition set to the one defined for the link. For details on how to use this in your tracking code, see Event Tracking in the Asynchronous Migration Examples guide, which shows how to do this in all versions of the tracking code. For background information on Event Tracking itself, see Event Tracking in this Help Center.

Comments