Created
September 16, 2013 23:04
-
-
Save kerotaa/6587825 to your computer and use it in GitHub Desktop.
クリックカウントをdata属性で管理したいときに使う。
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
$('[data-ga-count]').on('click.ga', function() { | |
var $this = $(this), | |
data = $this.data('ga-count'), | |
splitter = ':'; | |
if (data.indexOf(splitter) == -1 || $this.data('ga-counted')) return true; | |
$this.data('ga-counted', true); | |
data = data.split(splitter); | |
_gaq.push(['_trackEvent', data[0], 'click', data[1]]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment