Created
May 20, 2015 22:47
-
-
Save jaymay/a1c2c84b98cc20dd5bd1 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.account.subdomain; | |
ga('set', 'dimension2', dimensionValue); | |
var dimensionValue = HelpCenter.account.name; | |
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