For version 4, on all pages
<script type="text/javascript">
var monitus = monitus || {};
monitus.callback = function(pTrigger) {
switch(pTrigger) {
case "tracker_created":
// The GA tracker has been created
break;
case "tracker_before_tracking":
// Right before "_trackPageView" is called
// appropriate for setting custom variables and content groups
break;
case "tracker_after_tracking":
// After GA has tracked the current page view
break;
case "visitor_data_changed":
// Called when the monitus.visitor data structure is updated with new values
break;
case "cart_setup":
// Called when the cart recovery mechanism has been setup
break;
}
};
...
[regular monitus one-liner installaiton code]
</script>
For version 3.1 and earlier:
On non-checkout pages AND the confirmation page:
<script type="text/javascript">
...
monitus_ga_callback = function(pStep, pTracker) {
switch(pStep) {
case "initialize":
/*
This step is for anything you want to do before the tracker is created; this should not be used to customize the tracker - use the "customize" case instead.
** pTracker is not used here.
*/
break;
case "customize":
/*
Customize the tracker object, before "_initData" is called on it.
if you need to distinguish tracker objects (pqTracker, woTracker...) you can use the pTracker variable to compare, as in: if(pTracker == _MONITUS.pageTracker) { /*customize _MONITUS.pageTracker*/ }
*/
break;
case "finalize":
/*
In this step, the monitus pageview has been sent; note that on the confirmation page, the transaction has not been sent by this time.
** pTracker is not used here.
*/
break;
case "postprocess":
/*
This step happens at the very end of the GA coe - everything has been sent to GA.
** pTracker is not used here.
*/
break;
}
}
...
if(typeof(monitus_init) == "function") monitus_init(<store ID>, "new");
</script>
On the checkout wrapper page:
<script type="text/javascript">
...
if(!document.URL.match(/sectionId=ysco.confirm/)) {
monitus_ga_callback = function(pStep, pTracker) {
switch(pStep) {
case "initialize":
/*
This step is for anything you want to do before the tracker is created; this should not be used to customize the tracker - use the "customize" case instead.
** pTracker is not used here.
*/
break;
case "customize":
/*
Customize the tracker object, before "_initData" is called on it.
if you need to distinguish tracker objects (pqTracker, woTracker...) you can use the pTracker variable to compare, as in: if(pTracker == _MONITUS.pageTracker) { /*customize _MONITUS.pageTracker*/ }
*/
break;
case "finalize":
/*
In this step, the monitus pageview has been sent; note that on the confirmation page, the transaction has not been sent by this time.
** pTracker is not used here.
*/
break;
case "postprocess":
/*
This step happens at the very end of the GA coe - everything has been sent to GA.
** pTracker is not used here.
*/
break;
}
}
...
if(typeof(monitus_init) == "function") monitus_init(<store ID>, "new");
}
</script>