diff --git a/themes/Hacks2013/functions.php b/themes/Hacks2013/functions.php index 7bf296a..83052f5 100644 --- a/themes/Hacks2013/functions.php +++ b/themes/Hacks2013/functions.php @@ -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' ); diff --git a/themes/Hacks2013/js/socialtrack.js b/themes/Hacks2013/js/socialtrack.js new file mode 100644 index 0000000..eeaf4b8 --- /dev/null +++ b/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']); + }); +});