aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet.com/posters.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/web/cobrands/fixmystreet.com/posters.js b/web/cobrands/fixmystreet.com/posters.js
new file mode 100644
index 000000000..caf09fd0e
--- /dev/null
+++ b/web/cobrands/fixmystreet.com/posters.js
@@ -0,0 +1,29 @@
+$.fn.link_track = function(eventCategory, eventAction, eventLabel) {
+ this.on('click', function(e) {
+ if (typeof ga === 'undefined') {
+ return;
+ }
+ var url = $(this).attr('href'),
+ name = $(this).attr('data-' + eventLabel),
+ callback = function() {
+ window.location.href = url;
+ };
+ if (e.metaKey || e.ctrlKey) {
+ callback = function(){};
+ } else {
+ e.preventDefault();
+ }
+ if (typeof ga !== 'undefined') {
+ ga('send', 'event', eventCategory, eventAction, name, {
+ 'hitCallback': callback
+ });
+ setTimeout(callback, 2000);
+ } else {
+ callback();
+ }
+ });
+};
+
+$(function() {
+ $("[data-goodielink]").link_track('goodie', 'download', 'goodielink');
+});