Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add borrow page click tracking using archive_analytics.send_ping() he…
…lper
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* OpenLibrary-specific convenience functions for use with Archive.org analytics.js | ||
* | ||
* Depends on Archive.org analytics.js function archive_analytics.send_ping() | ||
* | ||
* Usage: | ||
* $("select#role").add_new_field({href: "#role-popup"}); | ||
* | ||
*/ | ||
|
||
archive_analytics.ol_send_event_ping = function(values) { | ||
var endTime = new Date(); | ||
archive_analytics.send_ping({ | ||
'service':'ol', | ||
'kind':'event', | ||
'ec':values['category'], | ||
'ea':values['action'], | ||
'el':values['label'], | ||
'ev':values['value'], | ||
'loadtime':(endTime.getTime() - startTime.getTime()), | ||
'cache_bust':Math.random() | ||
}); | ||
} |