Title: [Plugin: Contact Form 7] Need to use form variable in Google Analytics javascript
Last modified: August 20, 2016

---

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

 *  [thinkun](https://wordpress.org/support/users/thinkun/)
 * (@thinkun)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/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/](http://wordpress.org/extend/plugins/contact-form-7/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [thinkun](https://wordpress.org/support/users/thinkun/)
 * (@thinkun)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-need-to-use-form-variable-in-google-analytics-javascript/#post-2570111)
 * 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.

 * ![](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/)

 * 1 reply
 * 1 participant
 * Last reply from: [thinkun](https://wordpress.org/support/users/thinkun/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-need-to-use-form-variable-in-google-analytics-javascript/#post-2570111)
 * Status: not resolved