WordPress.org

Support

Support » Plugins and Hacks » Contact Form 7 » [Plugin: Contact Form 7] Need to use form variable in Google Analytics javascript

[Plugin: Contact Form 7] Need to use form variable in Google Analytics javascript

  • We’re currently using Contact Form 7 for a user contact form on our site. We are tracking Goals (conversions) in Google Analytics as pageviews that are tracked when the contact form is submitted. This is working fine.

    However, we’d like to attach the [your-name] field in our contact form to the user’s session as a Custom Variable in Google Analytics. We’re using the following code in the additional settings box to do this:

    on_sent_ok: "_gaq.push(['_trackPageview', '/contact-us/august-sale']); _gaq.push(['_setCustomVar', 1, 'LeadName', '#your-name', 1]); window.location = 'http://www.example.com/thank-you/';"

    This is sending the custom variable fine, however all conversions are coming through as simply “#your-name” rather than the actual name entered by the user. Is there a way we can use the form variable in this code?

    Your help would be much appreciated.

    http://wordpress.org/extend/plugins/contact-form-7/

Viewing 1 replies (of 1 total)
  • Is anyone able to provide an answer to this? I’ve attached the “your-name” id to the field we’d like to use.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Contact Form 7] Need to use form variable in Google Analytics javascript’ is closed to new replies.
Skip to toolbar