Commit b8f6331b authored by Leigh B Stoller's avatar Leigh B Stoller

Generate some GA events from the ajax request path, playing around.

parent 8f51dec6
...@@ -106,6 +106,14 @@ window.APT_OPTIONS.initialize = function (sup) ...@@ -106,6 +106,14 @@ window.APT_OPTIONS.initialize = function (sup)
$('body').show(); $('body').show();
}; };
window.APT_OPTIONS.gaAjaxEvent = function (route, method, code)
{
if (window.GOOGLEUA === undefined) {
return;
}
ga('send', 'event', 'ajax', route, method, code);
}
APT_OPTIONS.CallServerMethod = function (url, route, method, args, callback) APT_OPTIONS.CallServerMethod = function (url, route, method, args, callback)
{ {
// ignore url now. // ignore url now.
...@@ -118,7 +126,12 @@ APT_OPTIONS.CallServerMethod = function (url, route, method, args, callback) ...@@ -118,7 +126,12 @@ APT_OPTIONS.CallServerMethod = function (url, route, method, args, callback)
return $.ajax({ return $.ajax({
// the URL for the request // the URL for the request
url: url, url: url,
success: callback, success: function (json) {
window.APT_OPTIONS.gaAjaxEvent(route, method, json.code);
if (callback !== undefined) {
callback(json);
}
},
// the data to send (will be converted to a query string) // the data to send (will be converted to a query string)
data: { data: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment