????
Current Path : /home2/morganrand/backup.morganrand.com/wp-content/plugins/ |
Current File : /home2/morganrand/backup.morganrand.com/wp-content/plugins/wanderfuls-google-analytics.php |
<?php /* Plugin Name: Wanderfuls Google Analytics Plugin Plugin URI: http://www.wanderfuls.com Description: Adds a Google analytics tracking code to the head section of your website, by hooking to wp_head. Author: Lukasz Zywluk Version: 1.0 */ function wpmudev_google_analytics() { ?> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-3493709-1', 'auto'); ga('require', 'displayfeatures'); ga('send', 'pageview'); // If the client supports replaceState, strip utm tags out of the query string after GA loads. // Source: https://wistia.com/blog/fresh-url ga(function () { if (!window.history.replaceState) { return; } var cleanSearch = window.location.search.replace(/utm_[^&]+&?/g, '').replace(/&$/, '').replace(/^\?$/, ''); window.history.replaceState({}, '', window.location.pathname + cleanSearch); }); </script> <?php } add_action( 'wp_head', 'wpmudev_google_analytics', 10 );