Title: Universal Analytics Tracking Error
Last modified: August 21, 2016

---

# Universal Analytics Tracking Error

 *  [atelierstudios](https://wordpress.org/support/users/atelierstudios/)
 * (@atelierstudios)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/universal-analytics-tracking-error/)
 * Hi
 * I have been using Contact Form 7 for a while now and track all of my form submissions
   using the on_sent_ok: “_gaq.push([‘_trackPageview’, ‘/contact-us/complete’]);”.
   I have recently upgraded my analytics to Google Universal Analytics and noticed
   that the confirmation message no longer appears when I submit a form, I receive
   the email but no confirmation message to say the email has been sent.
 * I am getting the following javascript error
 * Uncaught ReferenceError: ga is not defined
 * I am using the following script in the Additional Settings box on the contact
   form.
 * on_sent_ok: “ga(‘send’, ‘pageview’, ‘/contact-us/complete’);”
 * Is there any fix for this besides hacking the core code as per this example.
 * [http://www.silenceit.ca/2011/02/09/how-to-track-contact-form-7-submissions-with-google-analytics/](http://www.silenceit.ca/2011/02/09/how-to-track-contact-form-7-submissions-with-google-analytics/)
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

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

 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/universal-analytics-tracking-error/#post-4667929)
 * Can I see the site?
 *  [Drew Hammond](https://wordpress.org/support/users/drewhammond/)
 * (@drewhammond)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/universal-analytics-tracking-error/#post-4667930)
 * It sounds like you haven’t updated your GA tracking code to the new [universal analytics code](https://developers.google.com/analytics/devguides/collection/analyticsjs/)
   yet.
 *  Thread Starter [atelierstudios](https://wordpress.org/support/users/atelierstudios/)
 * (@atelierstudios)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/universal-analytics-tracking-error/#post-4667945)
 * Hi Guys
 * Thanks for your feedback, DrewHammond you got me thinking about the analytics
   code, whilst I had already updated to Universal Analytics I thought I would try
   copying the Universal Analytics code from the analytics account again just to
   make sure it was correct. After copying the code I noticed that it had been updated(
   see examples below). The contact forms now work fine with this latest version
   of the Universal Analytics code?
 * OLD VERSION – UNIVERSAL ANALYTICS CODE – Doesn’t work with Contact Form 7
 *     ```
       <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<http://www.google-analytics.com/analytics.js>
       ');
   
       ga('create', 'UA-40598337-00000', '00000000.co.uk');
       ga('send', 'pageview');
   
       </script>
       ```
   
 * NEW VERSION – UNIVERSAL ANALYTICS CODE – Does work with Contact Form 7
 *     ```
       <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-40598337-000000', '000000000.co.uk');
         ga('send', 'pageview');
   
       </script>
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been permanently damaged by the forum’s
   parser.]_

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

The topic ‘Universal Analytics Tracking Error’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [atelierstudios](https://wordpress.org/support/users/atelierstudios/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/universal-analytics-tracking-error/#post-4667945)
 * Status: not resolved