Last active
August 29, 2015 14:17
-
-
Save jaymay/4f9f78274456ccc800c3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$(document).ready(function() { | |
// stuff here | |
// identify a user's attributes | |
var dimensionValue = HelpCenter.user.role; | |
ga('set', 'dimension1', dimensionValue); | |
var dimensionValue = HelpCenter.user.name; | |
ga('set', 'dimension2', dimensionValue); | |
var dimensionValue = HelpCenter.user.email; | |
ga('set', 'dimension3', dimensionValue); | |
// capture submit a ticket request event | |
$('a.submit-a-request, .article-more-questions a').on('click', function(e) { | |
var $this = $(this), | |
path = window.location.pathname; | |
_gs('event', 'Submit Request', { path: path }); | |
}); | |
// capture search box ticket deflection event | |
$("#new_request").on('click', '.searchbox-suggestions a', function(e) { | |
var $this = $(this), | |
link = $this.attr('href'); | |
_gs('event', 'Ticket Deflection', { link: link }); | |
}); | |
// capture a social share event | |
$('.share a').on('click', function(e) { | |
var $this = $(this), | |
type = $this.attr('class').replace('share-',''), | |
path = window.location.pathname; | |
_gs('event', 'Social Share', { path: path }); | |
}); | |
// capture a search event | |
$('form[role="search"]').on('submit', function(e) { | |
var $this = $(this), | |
query = $this.find('input[type="search"]').val().toLowerCase(); | |
_gs('event', 'Search', { query: query }); | |
}); | |
// maybe more stuff here | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment