Using Gravity Forms to collect page-specific referer

Gravity Forms is by far one of my favorite WordPress plugins, and I’ve used it every which way: for front-end post creation forms, as a job application form for a family owned oil company, and for the Contact Form on my own site.

Most recently, I built a contact form for a site that sold tickets to hundreds of plays and broadway shows. The need: Answer questions from prospective clients looking to purchase tickets. The catch: Use only one form, but somehow pass along what page or show the user is inquiring about.

The fix? The Gravity Forms {referer} merge tag, used as a default value for a hidden field. And voila – we pass the source page URL to the form and print it alongside the data submitted by the user so that the client knows exactly which page the user was viewing when the clicked the contact link.

Here’s how to put it in action yourself:

  1. In your Gravity Form, add a hidden field. This field won’t display for your users, but its content will display in the form’s entry, both when emailed to the administrator and when stored in the backend list of form entries.
  2. Name your hidden field “Source URL” or “Referral Page”, or whatever makes sense for your site.
  3. Click the Advanced Tab, and find the Default Value field. Use the merge tag dropdown to the right to select the HTTP Referer URL tag.

Ready to test it out? Embed a link to the page containing your form on another page on your site. Click that link to access the form, and fill it out. When you review the data submitted, you will see the URL of the page with the link in the data received. And then you’ll know exactly which page the user was reviewing when they filled out your feedback form!