Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/loggly.tracker-2.1.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/loggly.tracker-2.1.min.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/loggly.tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}
}
},
push: function(data) {
push: function(data, callback) {
var type = typeof data;

if( !data || !(type === 'object' || type === 'string') ) {
Expand Down Expand Up @@ -142,11 +142,11 @@
return;
}

self.track(data);
self.track(data, callback);


},
track: function(data) {
track: function(data, callback) {
// inject session id
data.sessionId = this.session_id;

Expand All @@ -156,7 +156,10 @@
xmlHttp.open('POST', this.inputUrl, true); //true for asynchronous request
xmlHttp.setRequestHeader('Content-Type', 'text/plain');
xmlHttp.send(JSON.stringify(data));

if(typeof callback === "function"){
xmlHttp.onreadystatechange = function(event){callback(event,data)};
}

} catch (ex) {
if (window && window.console && typeof window.console.log === 'function') {
console.log("Failed to log to loggly because of this exception:\n" + ex);
Expand Down