Gravity Forms is an easy to use advanced form builder for WordPress websites. These forms can easily integrate into SharpSpring by following the steps below. Prior to following the steps, you will need access to your SharpSpring account, your WordPress account, and must be using Gravity Forms on your site.
Developer instructions for integrating Gravity Forms
Below are step-by-step instructions for developers to use to integrate with Gravity Forms.
Step One: Create a Native Form in SharpSpring. We will NOT be embedding this on a page of our site, but we will be referencing this code during setup. If you have already embedded a SharpSpring tracking code for the form, it must be removed from your page before following these steps. Copy the code and place in a text editor (Atom, Brackets, etc.)
Step Three: Retrieve the ID for the Gravity Form we wish to integrate. This value is visible in when creating a new Gravity Form in the upper left corner, and appears in the ID column of the Edit Forms section.
Step Four: Create our function. In order to integrate our Gravity Form into SharpSpring, we need to add a section of code to our functions.php file in WordPress. Copy the code snippet below and paste into our text editor.
Step Five: Edit our code snippet. Make the following edits:
- On lines one and two, replace the three occurrences of "#" with the FormID for the Gravity Form we are integrating with SharpSpring.
- On line three, replace the string beginning 'https:...' with the string from line three of the Native Form Tracking Script we created in Step One.
- On line four, replace the string beginning 'xxXX...' with the string from line four of the Native Form Tracking Script we created in Step One.
- Each field within your Gravity Form needs to have a line in the $body array.
- The value on the left is the field name as it will be sent to SharpSpring. You will still need to map these fields, but providing a clear name here will make that easier. It is best to make these field names alphanumeric, as punctuation and other special characters may cause this to fail.
- 'fieldID' is the ID of the field value on the Gravity Form. Each Gravity Form field has a unique ID.
- The last line ('trackingid__sb'...) must be included in order to grab the cookie and establish tracking to the lead correctly.
Below is an example of how the code snippet will look once complete.
NOTE: If you are using a checkbox field, you'll need to add additional code. Check out our article on Using Checkbox Fields and Subfields for Gravity Forms.
Step Six: Add the completed code snippet into the functions.php file within your WordPress theme editor.
Step Seven: Submit the form and map your fields within SharpSpring.
NOTE: You will need to generate a block of this code for each Gravity Form you would like to track in SharpSpring.