Skip to content

Commit

Permalink
Bug 1077575 - remove extraneous page IDs from tracking events
Browse files Browse the repository at this point in the history
  • Loading branch information
craigcook committed Oct 14, 2014
1 parent 68b08e0 commit aff3b02
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions media/js/mozorg/contribute/contribute-2015-ga.js
Expand Up @@ -8,18 +8,17 @@ $(function () {
// Track clicks in main navigation
$('#contribute-nav-menu li a').on('click', function(e) {
var label = $(this).data('label');
var page = $('body').prop('id');
var newTab = (this.target === '_blank' || e.metaKey || e.ctrlKey);
var href = this.href;
var callback = function() {
window.location = href;
};

if (newTab) {
gaTrack(['_trackEvent', 'Contribute Nav Interactions ', 'nav click - ' + page, label]);
gaTrack(['_trackEvent', 'Contribute Nav Interactions ', 'nav click', label]);
} else {
e.preventDefault();
gaTrack(['_trackEvent', 'Contribute Nav Interactions ', 'nav click - ' + page, label], callback);
gaTrack(['_trackEvent', 'Contribute Nav Interactions ', 'nav click', label], callback);
}
});

Expand Down Expand Up @@ -194,35 +193,33 @@ $(function () {

// Track event links in the footer
$('.contrib-extra .event-link').on('click', function(e) {
var page = $('body').prop('id');
var newTab = (this.target === '_blank' || e.metaKey || e.ctrlKey);
var href = this.href;
var callback = function() {
window.location = href;
};

if (newTab) {
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom - ' + page, href]);
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom', href]);
} else {
e.preventDefault();
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom - ' + page, href], callback);
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom', href], callback);
}
});

// Track 'all events' link in the footer
$('.contrib-extra .events-all a').on('click', function(e) {
var page = $('body').prop('id');
var newTab = (this.target === '_blank' || e.metaKey || e.ctrlKey);
var href = this.href;
var callback = function() {
window.location = href;
};

if (newTab) {
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom - ' + page, 'See All Events']);
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom', 'See All Events']);
} else {
e.preventDefault();
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom - ' + page, 'See All Events'], callback);
gaTrack(['_trackEvent', 'Contribute Interactions', 'Contribute Extra Links at Bottom', 'See All Events'], callback);
}
});

Expand Down

0 comments on commit aff3b02

Please sign in to comment.