WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Need to use form variable in Google Analytics javascript (2 posts)

  1. thinkun
    Member
    Posted 2 years ago #

    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/

  2. thinkun
    Member
    Posted 2 years ago #

    Is anyone able to provide an answer to this? I've attached the "your-name" id to the field we'd like to use.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic