Option to track with virtual pageviews #15

chhib opened this Issue Feb 27, 2012 · 3 comments

2 participants


Say, file downloads, we often track with virtual pageviews:

This is because we see these type of files, semantically, as page views, they often open in the browser or some kind of viewer. We apply this to outbound links as well. This comes with the benefit of setting upp great goal funnels, which still is pretty limited with events.

Would be great to be able to alter something along the lines:
_gas.push(['_trackOutboundLinks', {method: 'pageview', path: '/virtual/external-link/'}]);
_gas.push(['_trackOutboundLinks', {method: 'event', category: 'External Link'}]);


I definitively would like to have that feature. But I think the best approach would bo to fire a VPV in addition to the Event. So we have a full report with all downloads and VPVs for those that we consider pages. You can currently do both in GAS using Hooks. So I wonder if the best approach to solve this bug is to document this method to fix using Hooks or to add an option to _trackOutboundLinks. The correct way to do it using hooks is:

_gas.push(['_addHook', '_trackEvent', function(cat, act, lab, val){
    if (cat === 'Download') {
        var vpv_extensions = ['doc', 'pdf'];
        if(vpv_extensions.indexOf(act) > -1) {
            _gas.push(['_trackPageview', '/download/' + lab]);
           //return false; // You may want to return false here to cancel the Event
    return [cat, act, lab, val];

Hooks are a very flexible and power feature of GAS that could use some better documentation.


As for Outbound links I don't think it's a good use case. Outbound links as VPV is usually a bad practice. If you want to do that I'd say that you should write a hook to change the outbound link to a vpv.

For Downloads I agree there are good use cases and an option should be added.


Decided not to implement it. Should be handled as hooks when this is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment