: How to Trigger GA Event for Every Single Pageview (of a certain type) Thanks, edited my question. I need a reliable way to capture a GA event whenever the GA tracking code fires for a particular
Thanks, edited my question.
I need a reliable way to capture a GA event whenever the GA tracking code fires for a particular page only. Doing so because we want to assign a dollar value to simply viewing a certain page (or type of page), and this can happen multiple times per visit, so a destination based goal isn't feasible
I tried using a window.onload javascript (also tried window.onbeforeunload) to trigger the event, but I can only get about 80% of the pageviews to become events (and only about 12% for our mobile website!). Not accurate enough yet for "prime time"
Thanks :)
More posts by @Turnbaugh106
1 Comments
Sorted by latest first Latest Oldest Best
In your GA script you can place the event. Although I can't think of a single reason you would want to do this, that's your thing, not mine I suppose.
Just place your event in the same script tag right above the first line (usually var _gaq = _gaq || [];).
Also, PHP has nothing to do with JS as it is server-side, JS is client-side.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.