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

  1. thinkun
    Posted 4 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.


  2. thinkun
    Posted 4 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

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic