Advertisement
BakerMan

GAQ on tribe_is_month() (TEC 2.0.11)

Mar 7th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. // By the template_include fires TEC should know what view is being loaded
  2. add_filter('template_include', 'eventAnalytics', 50);
  3.  
  4. /**
  5.  * Test to see if it is the month view and embed GA code in the footer if so.
  6.  *
  7.  * @param $passthrough
  8.  * @return mixed
  9.  */
  10. function eventAnalytics($passthrough) {
  11.     if (tribe_is_month()) add_action('wp_footer', 'embedGAQ');
  12.     return $passthrough;
  13. }
  14.  
  15. /**
  16.  * Embed Google Analytics code
  17.  */
  18. function embedGAQ() {
  19.     echo '<script>/* Code goes here */</code>';
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement