Use Gravity Forms to Capture Refferal URLs

Gravity Forms is a popular contact form plugin for WordPress. A ton of sites are already using Gravity forms to handle all contact forms. Its super easy to use and seems to be the go-to choice for many site owners.

Recently, I built a contact form for a client site that sells tickets to dozens of plays and broadway shows. Our client was receiving a large number of emails asking if tickets were available for a show. The problem was, the customer never mentioned which show he/she wanted to attend.

The need: Answer questions from prospective customers looking to purchase tickets.

The catch: Use only one form, but somehow pass along what page or show the customer is inquiring about.

The fix? The Gravity Forms {referer} merge tag used as a hidden field in our form. We pass the source page URL to the form and print it alongside the data submitted by the customer so that our client knows exactly which page the customer was viewing when he/she submitted the contact form.

Here’s how it works:

In your Gravity Form, add a hidden field. This field won’t display for your users, but its content will display when submitted both when emailed to the administrator, and when stored in the backend list of form entries.
Name your hidden field Source URL or Referral Page, or whatever makes sense for your form. 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. Save your form. Thats it!

use-gravity-forms-to-capture-referral-page

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 entries submitted for that form, you will see the URL in the last column under Referral Page. Now you’ll know exactly which page the user was reviewing when they filled out your form.