Google Analytics Head 1.4.4.1
Hi there folks,
we’ve got brand new Google Analytics Head plugin for you! There are some big news in this version. First, adding plugin name to the tracking code is optional and disabled by default. Of course it’s nothing big.
Big thing is, I’ve added two action hooks and one filter. And one, very important thing – triggering those actions and filtering may be enabled/disabled in options screen. So, if you want to interfere with Google Analytics Head plugin, ask your user to enable firing actions!
Examples:
1 2 3 4 |
add_action( 'pp_google_analytics_head_before', function() { echo '<!-- Hello! I am here, just before putting google tracking code! -->' . PHP_EOL; $of_course = 'I do not have to print here, I may do something else!'; } ); |
1 2 3 |
add_action( 'pp_google_analytics_head_after', function() { $i_just = 'printed google code...'; } ); |
1 2 3 |
add_filter( 'pp_google_analytics_head_output', function( $s ) { return str_replace( 'Google Analytics', 'Doodle Analytics', $s ); } ); |
Notice 1: all that examples will work, if you enable triggring actions and use filters. If you don’t, it won’t work but it won’t produce any error either.
Notice 2: all examples are good to use in your theme functions.php file, however it isn’t the only possibility. You may put it whenever you want, just remember one thing – all those actions are happens after wp_loaded action is triggered.