cpopolo
cpopolo

Reputation: 53

Configure Google Analytics _TrackEvent so that results appear in basic reports

I have several PDFs available for download on a page, and I have configured them with the onclick="ga.push(etc)" and that all works fine. However, these events are reported separately in the "Events" menu of GA, and therefore I cannot report on these events by Geography, Demographics, Geo, etc.

Is there a way to specifically configure the options of the _TrackEvent onclick event to have the results appear as if the PDF was an ordinary page? I've tried setting the second option to 'pageview' but that doesn't work.

Upvotes: 1

Views: 25

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

Yes. Instead of sending an event you can send a "virtual pageview" by passing a custom page page to the pageview call (either because the page in question does not physically exist or, as in your case, it's a document type that cannot execute tracking code by itself). So instead of using event tracking you would fire another pageview call like this:

ga('send', 'pageview', '/myPDFDOcument.pdf');

and the url wenter link description hereould appear in the page report. You can also send a document title - if you want to override mutiple default values you pass an object as the third parameter with key=>value pairs:

ga('send', 'pageview', {
'page':'/myPDFDOcument.pdf',
'title': 'My document title'
});

See the field reference for more options.

Upvotes: 1

Related Questions