Skip to content

Commit

Permalink
added google analytics code event tracking (huacnlee#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimeremeev authored and huacnlee committed Nov 3, 2016
1 parent a842365 commit cafa868
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/social-share-button.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ window.SocialShareButton =
via = encodeURIComponent($parent.data("via") || '')
desc = encodeURIComponent($parent.data("desc") || ' ')

# tracking click events if google analytics enabled
ga = window[window['GoogleAnalyticsObject'] || 'ga']
if typeof ga == 'function'
ga('send', 'event', 'Social Share Button', 'click', site)

if url.length == 0
url = encodeURIComponent(location.href)
switch site
Expand Down

0 comments on commit cafa868

Please sign in to comment.