• 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/

    https://ww.wp.xz.cn/plugins/contact-form-7/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Can I see the site?

    It sounds like you haven’t updated your GA tracking code to the new universal analytics code yet.

    Thread Starter atelierstudios

    (@atelierstudios)

    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.