Title: Why old GA code?
Last modified: August 22, 2016

---

# Why old GA code?

 *  [HikingMike](https://wordpress.org/support/users/hikingmike/)
 * (@hikingmike)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/why-old-ga-code/)
 * I would like to use the new Google Analytics (asynchronous) code, and use that
   for events tracking etc as well, but this plugin still puts in the old GA code.
 * Will this be updated? The last plugin update was just a few weeks ago. Is it 
   being held back? Maybe lots of people’s analytics will stop working if the plugin
   switches to using the new code?
 * This seems like a problem to me. I also saw another plugin, Easy Google Analytics
   for WordPress, also still uses the old code. Perhaps we just need a new plugin,
   exact same but with the new code. That would prevent us that have modified the
   code ourselves to have to worry about future updates switching us back to the
   old Analytics code.
 * [https://wordpress.org/plugins/googleanalytics/](https://wordpress.org/plugins/googleanalytics/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Moshe Harush](https://wordpress.org/support/users/localghost-il/)
 * (@localghost-il)
 * [11 years ago](https://wordpress.org/support/topic/why-old-ga-code/#post-5805938)
 * you can use in my option:
    [https://wordpress.org/support/topic/update-for-universal-analytics-tracking-code?replies=5](https://wordpress.org/support/topic/update-for-universal-analytics-tracking-code?replies=5)
 *  [getnoizefu5k4](https://wordpress.org/support/users/getnoizefu5k4/)
 * (@getnoizefu5k4)
 * [11 years ago](https://wordpress.org/support/topic/why-old-ga-code/#post-5805951)
 * Howdy,
    Is this the function where I need to replace the code and after replacing
   the code will it look like this? Thanks!
 * Original
 * function googleanalytics() {
    $web_property_id = get_option(‘web_property_id’);?
   >
 * New
 * function googleanalytics()
    <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’, ‘<?php echo $web_property_id; ?>’, ‘<?php echo str_replace(‘www.’,”,
   $_SERVER[‘SERVER_NAME’]); ?>’);
    ga(‘send’, ‘pageview’); </script>
 * ?>

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Why old GA code?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/googleanalytics_b8e236.svg)
 * [ShareThis Dashboard for Google Analytics](https://wordpress.org/plugins/googleanalytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/googleanalytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/googleanalytics/)
 * [Active Topics](https://wordpress.org/support/plugin/googleanalytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/googleanalytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/googleanalytics/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [getnoizefu5k4](https://wordpress.org/support/users/getnoizefu5k4/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/why-old-ga-code/#post-5805951)
 * Status: not resolved