Mobile app version of vmapp.org
Login or Join
Cody1181609

: How to pass the Page filename to Google Analytics trackEvent() I want to easily view Events for a particular page in Google Analytics. Is there a way to pass in the page filename to the event

@Cody1181609

Posted in: #GoogleAnalytics #Javascript

I want to easily view Events for a particular page in Google Analytics.

Is there a way to pass in the page filename to the event call?

e.g.,

_gaq.push(['_trackEvent', 'ACTION-DESCRIPTION', 'ACTION','LABEL-usually-PAGE']);

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Cody1181609

2 Comments

Sorted by latest first Latest Oldest Best

 

@Welton855

You can define a variable to store the pathname and then use that variable in the event

var path = document.location.pathname
_gaq.push(['_trackEvent', 'category', 'action', 'path = '+path]);

10% popularity Vote Up Vote Down


 

@Jennifer507

I would suggest using Google Tag Manager, as it allows you to define variables for event tracking.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme