📜 ⬆️ ⬇️

Google Analytics tracking _trackPageView

Colleagues, there is a question that, in my opinion, may be of interest not only to me, therefore I publish it here.
In short, I described it here : (in English).

There is a task - to track user actions using custom-variables in Google Analytics. When the result of the action is a separate page - no questions - I just put a tracking code like this on this page:
pageTracker._setCustomVar (1, 'event', 'segment', 3);
pageTracker._trackPageview ();
But if this is JS and the results of successful processing of ajax-page reload, then I can’t just put this code, because it will look like this:
pageTracker._setCustomVar (1, 'event', 'segment', 3);
pageTracker._trackPageview ();
window.location.reload ();
And this, as you understand, is stupid.

And the question is, is there such a simple thing in this tracking system as an oncomplete event, or something that would allow me to write, for example, like this: pageTracker._trackPageview ({'complete': function () { window.location.reload ()}});

If there is no such method, then I will have to redo these places, adding an update there without rebooting, for example. But, of course, I would like to avoid it.
')
Thank.

Source: https://habr.com/ru/post/86249/


All Articles