Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix #20 - add trackEvent for social share click
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Feb 20, 2014
1 parent 715b331 commit 359beb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions themes/Hacks2013/functions.php
Expand Up @@ -236,6 +236,13 @@ function mozhacks_load_scripts() {
if ( is_singular() && get_option('mozhacks_share_posts') && !is_page(array('home','about','demos','articles')) ) {
wp_enqueue_script( 'socialshare' );
}

// Register and load socialshare tracking script with jquery & socialshare
// dependencies
wp_register_script( 'socialtrack', get_template_directory_uri() . '/js/socialtrack.js', array('jquery', 'socialshare'));
if ( is_singular() && get_option('mozhacks_share_posts') && !is_page(array('home','about','demos','articles')) ) {
wp_enqueue_script( 'socialtrack', get_template_directory_uri() . '/js/socialtrack.js' );
}
}
add_action( 'wp_enqueue_scripts', 'mozhacks_load_scripts' );

Expand Down
8 changes: 8 additions & 0 deletions themes/Hacks2013/js/socialtrack.js
@@ -0,0 +1,8 @@
jQuery(document).ready(function(){
var ga = window._gaq || [];
jQuery('.share').click(function(){
ga.push(['_trackEvent',
'socialshare',
'click']);
});
});

0 comments on commit 359beb4

Please sign in to comment.