1. Home
  2. Knowledge Base
  3. General Help & Support
  4. API Connections
  5. Connecting the Lead Generation Element to Google Drive

Connecting the Lead Generation Element to Google Drive

Do you want to enable users to upload files through a Lead Generation form on your website which then gets saved in a Google drive? This is possible when you build an API connection between the Thrive Dashboard and the Google drive you want to use.

In this article we’ll show you how you can build an API connection between Thrive Dashboard and Google Drive, and how you can use the drive to save files that users upload through lead generation forms.

Obtaining a Google Drive Client ID and Secret Key

A Google client ID and secret key is the medium through which you can build a secure API connection between your Google account and the Thrive Dashboard on your website.

There are a few steps you’ll need to follow to obtain the client ID and secret key.

Enabling the Google Drive API

To begin enabling the Google Drive API, login to your Google account and open the Google APIs Console.

Clicking on this link will open the APIs and Services page. On this page, you can either choose to select a project you’ve created or opt to create a new one.

If you already have a project that you want to use, you can ignore the project creation steps and click Select a Project.

Select a project in the Google API console

After you click Select a Project, you’ll see a popup where you can click the project name you want to open.

To create a new project, click the Create Project button on the top right.

Create a new project in the Google API console.

 

When you click Create Project, you’ll be taken to a page where you’ll be asked to enter the Project name, Organization, and Location. To proceed, enter this information and click Create.

Enter the project name and other details in Google API console.

On the project page, click +Enable APIs and services.

Enable APis and services in the Google API project

Clicking +Enable APIs and services will take you to the Google API page where you can scroll down to Google Drive API, or use the search bar to search Google Drive in it.

Screen to search APIs in Google API library.

When you search Google Drive API, click on it.

Select Google drive API

Clicking on the Google Drive block on the API page will take you to the Google Drive API page. On this page, you’ll see two options that’ll allow you to either enable the Google Drive API for the project or try it once.

To enable this API, click the Enable button.

Enable the Google Drive API in your account.

Once enabled, you will be taken to the project page where you will see the Google Drive API enabled.

Enabling the Google Drive API does not mean you can use it as of yet. You’ll need to follow the steps below to obtain the client ID and Secret key for this API.

Once Enabled, you’ll need to proceed setting up credentials. To do this, click Credentials in the left column.

Click the Credentials option in the left panel.

Before you are able to create the Google API credentials, you’ll need to Configure the OAuth Consent Screen.

If you haven’t done so yet, you’ll see a notice on the Credentials page asking you to Configure the OAuth Consent Screen by clicking the button.

To proceed, click Configure Consent Screen.

Configure the consent screen button on the right.

Clicking the Configure consent screen button will take you to a page where you’ll be informed that the Google Auth Platform is not configured yet. To do this, click Get Started.

Setting up the Google Auth Platform

When you click Get Started, you’ll be taken to the Project Configuration page where you begin by entering the requested App Information, such as the Application name and your email address.

Google Auth Application information

After the application information, select the audience you want this application to be accessible to. Here, select External and click Next.

Select the audience for the Google project configuration

Once you select your audience, you’ll have to enter your contact information. These is/are the email IDs you’d want to receive important notifications in case there are any changes in your application.

Enter your contact information - the Email IDs

After you enter your contact information, you must click the checkbox to agree to Google API and services data policies, and click Continue.

Agree to Googles User Data Policy.

Once you click Continue, you are done with all the information required here. To proceed, click Create.

Now that you have configured the OAuth Consent screen, the next step is to generate the OAuth Credentials.

Generating the OAuth Credentials

When you configure the OAuth consent screen, you’ll be taken to the OAuth Overview page where you see an option to create an OAuth client. To do so, click the Create OAuth Client button.

Create an OAuth Client in your Google account.

Clicking the button will take you to a page to create the OAuth Client ID. Here, begin by entering the Application type. To set an application type, select Web application in the dropdown field.

Select application type - Web application while creating a client ID

After selecting the application type, you can change the default name used for this client ID.

Fill in the application type and the client name

Once you are done with these basic settings, what’s important is to set the redirect URLs.

To set the redirect URLs for this application scroll down to the Authorized Redirect URL section and click the + Add URL button.

Enter redirect URLs while creating a client ID

When you click the Add URL button, you’ll see an input field to enter the URL.

In this field enter the following URL by replacing “YOUR-SITE” with your domain name, and click Create.

https://[YOUR-SITE]/wp-admin/admin.php?page=tve_dash_api_connect

Example of an entered redirect URL while creating a client ID.

Clicking create will create the OAuth client and display the Client ID and Secret Key in a popup.

Generated Client ID and the secret key.

The Client ID and the Secret Key that you get here will be needed when you are connecting your Thrive Dashboard to Google Drive. Therefore, copy and save this for further use.

Building an API Connection Between Thrive Dashboard and Google Drive

After you’ve configured the OAuth Client and Credentials in Google API and services, you can move forward to integrate your Thrive Dashboard with Google.

To begin, open your WordPress admin area, navigate to Thrive Dashboard >> Thrive Dashboard, scroll down to API Connections and click the Manage Connections button.

Open the Thrive Dashboard to manage connections

On the API Connections page, click Add Connection.

click on the block to add more connections in Thrive Dashboard.

When it asks you to select the application you want to connect, select Google Drive in the dropdown.

Select Google drive as the app to build an API connection with Thrive Dashboard.

When you select Google Drive, enter the Client ID and Secret Key in the respective fields and click Connect.

Enter the Google account Client ID and Secret Key in the Thrive Dashboard connection fields.

To finalize the connection, you’ll need some permissions from the selected Google account. This will take you to a page where you need to select the Google account you want to use.

Select your Google account that will grant permissions.

When you select your Google account to be used, you’ll see another popup asking you to grant some permissions. On this popup click Allow.

Allow permissions to the domain

Once you click Allow, you’ll be taken back to the API connections in Thrive Dashboard with a success message saying the integration with Google drive is established.

Google drive connection ready in Thrive Dashboard.

Connecting a Lead Generation Element with Google Drive

Once you’ve connected your Thrive Dashboard with the Google Drive, you can now use it in a lead generation element on your website.

To be able to follow the steps below, please ensure you’ve added and set up a lead generation element on a Thrive Architect page. You can read more on using and setting up a Lead Generation element in our document here.

Setting Up a File Upload Field

To let users upload files through a Lead Generation element, please ensure you’ve added the File Upload field to the Lead Generation form.

To set things up, first open the page in the Thrive Architect editor.

Edit the page with Thrive Architect

When the page is opened in the Thrive Architect editor, click on the Lead Generation element added to the page. This will open the Form options in the left panel.

Click the Lead Generation element to view the form options

In the left panel, under Form Fields, click + Add New.

Add a new form field in the lead generation element.

After clicking Add New:

  • Select the Field type as File Upload
  • Enter the name of the field (optional)
  • Select whether you want to make this field mandatory. This means enable the Required option if you want the users to upload a file for successful form submission.
  • Decide whether you want to display a label with this field.

set the field type as File Upload.

Once you fill in these details, the next field lets you select where you want to send the uploaded files to. This is where you select Google Drive in the dropdown.

Select the uploaded file destination to Google Drive.

When you select Google Drive as the destination to send uploaded files, enter the folder URL in the next field. You can refer to our document here that’ll help you find the Google Drive Folder URL you want the files to be uploaded to.

Enter the folder URL of where you want the uploaded files to be saved.

After you enter the Google Folder URL, the next field allows you to set what the filename should be. This field will determine the filenames of those that users upload using this field.

In the Filename field you can use static text or use any one or a combination of the following shortcodes.

  • {email} – The filename will be the email address of the user who uploaded the file.
  • {date} – The filename will be the date on which the file was uploaded.
  • {time} – The filename will be the time when the file was uploaded.
  • {match} – The filename will be the same as the file that was uploaded.

For example, if you enter the following in the field “Image_{email}_{date}” the filename of the one a user uploads will be something like this: “[email protected]_dateOfUpload”.

When you finish setting up the field, click Apply.

Apply the changes to the File upload field.

Setting Up Allowed File Types

After you’ve added the File Upload field in the Lead Generation element, it’s time you select the file type you want to allow here.

To fix the file types you want to allow through the File Upload field, click the form on the page, in the left panel click, under Main Options, click the Edit Form Elements button.

Edit form elements in Edit mode

Clicking the Edit Form Elements button will open the form in an editor allowing you to edit the elements you see in there.

See the lead generation element in the edit mode.

While in the Form Elements editor, click the File Upload element and see the options open in the left panel.

See the file upload field options in the left panel while in the edit mode.

In the left panel, scroll down to the Allowed File Types option to select the file type or types you want to allow. You can select a single or multiple file types here.

Select the file types you want to allow the users to upload

Once you select the file types and finish all the other settings for the form, click Done to exit the Edit Mode.

Exit the edit mode by clicking done after you finish editing the form elements

Setting Up the Maximum Number and Size of Files

Now that you have the File Upload field set with the allowed file types, you can also set the maximum number of files a user uploads and the maximum file size you want to allow.

To do so, click the form on the page, in the left panel click, under Main Options, click the Edit Form Elements button.

Edit Form Elements on the Lead Generation Element.

Clicking the Edit Form Elements button will open the form in an editor allowing you to edit the elements you see in there.

Form Elements in Edit Mode

While in the Form Elements editor, click the File Upload element and see the options open in the left panel.

Form element options as seen in the left panel.

In the left panel, scroll down to the options that say Max Files and Max File Size. This is where you can enter the maximum value you want to set for each of them.

Enter the maximum number of files and the maximum size of files you want to allow the users to upload.

Once you select the maximum number of files and the maximum file size allowed and finish all the other settings for the form, click Done to exit the Edit Mode.

Click done when you finish editing the form elements to exit the edit mode.

After all of this please ensure you click the Save Work button while the page is open in the Thrive Architect editor. This will save all the changes you’ve made to the page, the Lead Generation element, the form and the File Upload field you just added.

We’ve just seen how you can connect your Thrive Dashboard to Google Drive and use it with a Lead Generation element on your website.

Next, do you want to add an email connection to your Lead Generation element? You can refer to our document here for step by step instructions on how to do it.

Was this article helpful?

Related Articles

>