This page may contain affiliate links. Please read my disclaimer for more information.

Gravity Forms Opt-in form for Multiple File Downloads [Advanced]

  |  by Chris Eggleston

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.

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)
Gravity Forms opt-in form fields

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.

  1. Click on the Hidden field
  2. Click on the Advanced settings section
  3. Click the merge tag selector icon
  4. Select the Embed Post/Page ID option
  5. Save the form
Hidden Field and Default Value

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.

WordPress Post ID
How to find the WordPress post ID

Alternatively, you can install a plugin like the one below, which will display the post/page ID in the WordPress list pages.

Reveal IDs Plugin

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

  1. In the form editor, go to Settings > Confirmations
  2. Click Add New
  3. Give the confirmation a Name
  4. Add your message and include the link to the download
  5. Configure conditional logic based on the Post ID field
  6. Add your post ID number
  7. Click Save Confirmation
Creating a text confirmation

Redirect Confirmation

  1. In the form editor, go to Settings > Confirmations
  2. Click Add New
  3. Give the confirmation a Name
  4. Select the Redirect option
  5. Enter the download URL
  6. Configure conditional logic based on the Post ID field
  7. Add your post ID number
  8. Click Save Confirmation
Creating a redirect 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.

Photo of author
About the Author
Chris Eggleston
Chris is not just a Gravity Forms enthusiast; he's a dedicated father and loving husband. As the proud owner of WP Mantis, he's on a mission to simplify the WordPress experience for site owners. He brings a unique perspective to the Gravity Forms community.

Advertisement

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments