A Gravity Forms user recently asked if there was a way to use a single opt-in form on multiple landing pages that delivered a different download for each page.
If you’re a little confused, let me provide a use case for this.
Let’s say you have a website that offers advice and products for fitness and weight loss, and you want to offer your site visitors different reports or ebooks on the various landing pages or blog posts throughout your site.
One page might have an opt-in for an ebook on how to lose 20 pounds in a week; another page might offer a report on how to gain 10 pounds of muscle in a week.
Instead of creating an opt-in form for each page or asset, you only want to use one form for all pages and all downloads.
Let’s get into the tutorial.
Requirements
This form does not require any add-ons, third party solutions, or custom code; it only requires that you have Gravity Forms installed on your site.
- Gravity Forms (any license type)
Building Your Form
For this tutorial, and because this is an opt-in form, I only want to collect the user’s name and email address, but I will also need one hidden field.
Necessary Fields:
- Name (Advanced Fields section)
- Email (Advanced Fields section)
- Hidden (Standard Fields section)
Instead of the Hidden field type, you do have the option of using a Single Line Text field with the field visibility set to hidden.
Configuring The Hidden Field
The hidden field is absolutely necessary for this to work; no skipping that field.
Now we need to set the {embed_post:ID} merge tag as the Default Value of that hidden field.
- Click on the Hidden field
- Click on the Advanced settings section
- Click the merge tag selector icon
- Select the Embed Post/Page ID option
- Save the form
Using this method will require that you know the post or page ID where the form is embedded.
What is & How to Find the Post/Page ID
Whenever you create a page or post in WordPress, that page/post is assigned a numerical number called the post ID.
To locate this ID, you can edit the page or post, and the ID will be included in the page URL in the browser address bar.
Alternatively, you can install a plugin like the one below, which will display the post/page ID in the WordPress list pages.
Creating Your Confirmations
These confirmations are key because they are going to be used to deliver the downloadable assets.
You can use either a text confirmation or redirect confirmation to deliver the downloadable file.
Each confirmation will need conditional logic configured based on the hidden field that is capturing the post ID.
Text Confirmation
- In the form editor, go to Settings > Confirmations
- Click Add New
- Give the confirmation a Name
- Add your message and include the link to the download
- Configure conditional logic based on the Post ID field
- Add your post ID number
- Click Save Confirmation
Redirect Confirmation
- In the form editor, go to Settings > Confirmations
- Click Add New
- Give the confirmation a Name
- Select the Redirect option
- Enter the download URL
- Configure conditional logic based on the Post ID field
- Add your post ID number
- Click Save Confirmation
Pro Tip:
How the download is handled, meaning whether the file is downloaded automatically or opened in the browser window, will depend on the file type and the browser.
For example, if you are delivering a PDF file, and the user is using a Chrome browser, that file will open in the browser window and the user will need to click the browser download button to actually download the file to their computer. On the other hand, if the user is using Safari, that PDF file will automatically download to their computer.
Watch the Entire Tutorial Here!
The Wrap Up
There you have it, a simple solution for using a single opt-in form across multiple pages to deliver a different downloadable file from each page.
This was intended to show you how you can do this with the basic Gravity Forms functionality and no add-ons.
You can, of course, extend this use case by adding things like email marketing integrations, notifications with the file as an attachment, displaying the text confirmation in a popup window, and much more.
If you’d be interested in a more advanced tutorial showing more ways of implementing this concept, let us know in the comments.
If you have any questions or need help, be sure to use the comments, and we’ll get back to you.