Mobile app version of vmapp.org
Login or Join
Turnbaugh106

: 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

@Turnbaugh106

Posted in: #Analytics #GoogleAnalytics #Javascript #Php

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 :)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Turnbaugh106

1 Comments

Sorted by latest first Latest Oldest Best

 

@Pierce454

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme