The following code will add Google Analytics tracking code to your WordPress site’s header. Simply replace “UA-000000000-1” with your analytics UA tracking code and insert the snippet into functions.php.


// Insert Google Analytics into the site header
function mwx_google_analytics() { ?>
 ///////// ADD YOUR GA SNIPPET HERE /////////
  <?php
  }
add_action( 'wp_head', 'mwx_google_analytics', 10 );

Leave a Reply

Get in Touch

Please fill out the form below and we will get back to you ASAP

  • This field is for validation purposes and should be left unchanged.