# Gravity Forms

> Set up conversion tracking for Gravity Forms submissions with AnyTrack. Use webhooks to track leads, registrations, and form completions across your ad campaigns.

> 🚧 **Limited**
>
> We currently do not offer setup support for custom integrations not listed in the <Glossary>Integration Catalog</Glossary>. Any guidance provided in our documentation for such integrations is to be used at your own risk and may no longer be updated or maintained.

In the next guide, we will learn how to start tracking leads from Gravity via webhook integration.

<Prerequisites
  title="Before you begin"
  items={[
    { label: "You have an AnyTrack account with a paid subscription", done: true },
    { label: "You have an active Gravity Forms account with the Webhooks add-on", done: true },
    { label: "The AnyTrack Tracking Tag is installed on your website", done: true },
  ]}
/>

**Why should I connect a webhook and not just track the leads via Javascript code?**

1. It's more accurate - there is no way to have duplications or to fire the event without leaving a real lead.

2. You will be able to collect the values of the lead, like email, phone, and more.

> 🚧 **Remember**
>
> The more data you send to AnyTrack the better the attribution and match rate will be in your ad platforms.

### **To start tracking your leads from Gravity, you will need the following:**

1. Gravity account.
2. An AnyTrack account with a Personal Plan or higher.
3. The AnyTrack Tracking Tag in the head section of your website.

## Getting started

1. Edit the Form you'd like to track.

2. Add a **hidden field**
   1. Default value `--CLICK-ID--`
   2. Field Label: `click_id`
   3. Enable the option: **ALLOW FIELD TO BE POPULATED DYNAMICALLY**

> ⚠ **Timing Note**
>
> The `--CLICK-ID--` placeholder is replaced by AutoTag after the AnyTrack Tracking Tag loads. On fast-loading or cached pages, the form may render before the tag is ready, leaving the placeholder unreplaced. If you see `--CLICK-ID--` appearing in your webhook data instead of an actual click ID, use this JavaScript snippet to programmatically set the value after the tag loads:
>
> ```javascript
> AnyTrack(function() {
>   var atclid = AnyTrack('atclid');
>   // Replace 'input_X_Y' with your actual Gravity Forms hidden field ID
>   var field = document.querySelector('input[name="input_X_Y"]');
>   if (field) field.value = atclid;
> });
> ```
>
> Add this script to your page (via a Custom HTML block or your theme's footer) to ensure reliable click ID capture. See [Click ID usage](/docs/generate-retrieve-and-use-atclid) for more details.

3. Install the **webhook add-on** in Gravity. ([install the Webhooks add-on](https://www.gravityforms.com/add-ons/webhooks/)) 

4. In AnyTrack: Create a custom integration

5. Set the fields value (any dummy value for now.)

**In order to add the webhook options to your Gravity form, follow the instructions:** 

1. Go to **Adds-Ons** under **Forms** 

2. Activate \*\*webhooks Add-On

   <br />

   <Image align="left" width="40% " src={readmeAsset1} />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

**In order to set the webhook follow the instructions:**

1. Return to the form

2. Open Settings > Webhooks 

3. Paste the AnyTrack webhook url.

4. Now map the Keys with the Values collected by gravity forms.

> 🚧 **Keys**
>
> Keys are to Gravity forms, what Parameters are to AnyTrack. 
>
> For example:
>
> | key       | parameter  | value              |
> | :-------- | :--------- | :----------------- |
> | email     | `email`    | `john@example.com` |
> | click\_id | `click_id` | `click_id`         |
>
> here is the full list of <a href='/docs/event-attributes'>parameters</a> AnyTrack supports.

<Image align="center" className="border" width="100% " border={true} src={readmeAsset2} />

5. Save

Your setup is complete.

### How to generate a webhook URL in AnyTrack:

**Step 1:** We have to create a custom integration.\
In order to do that, we will go to the **integrations** section and look for **custom:\
![Screen Shot 2022-03-03 at 15.22.32](./screen-shot-2022-03-03-at-15-22-32-88c7505af2.png)**  

**Step 2:**  Fill in the name of the integration:\
![Screen Shot 2022-03-03 at 15.25.56](./screen-shot-2022-03-03-at-15-25-56-eca38a95ba.png)

📘 **Note**

In the custom integration, the <code>click_id</code> parameter is required. Set a dummy value as we'll remove it later.

![Untitled 2 (1)](./untitled-2-1-c3f574fd62.png)

**Step 3:** After clicking **save**, we will get our URL. Please copy it until the question mark:\
![Untitled 3 (1)](./untitled-3-1-56bc81eaaf.png)

## Video Available

Check out our video below, which shows you how to set up Gravity Forms with AnyTrack.

<HTMLBlock html={"\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/RJFkkmpZKBU?si=TEGNBzsLaxZAfmsY\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n"} />

## Related Resources

- [Install AnyTrack Tag](/docs/install-anytrack-tag)
- [Setup Guide - Complete](/docs/getting-started)
- [Integration Event Log](/docs/integration-event-log)

<FaqAccordion>
  <FaqItem title="What is the difference between webhook and JavaScript tracking?">
    Webhook tracking is more accurate because there's no risk of duplications or events firing without a real lead being created. With webhook integration, you can also collect additional lead data like email and phone.
  </FaqItem>
  <FaqItem title="Can I send additional form data to AnyTrack?">
    Yes. The more data you send to AnyTrack the better the attribution and match rate will be in your ad platforms. Map any form fields you want to track as parameters in your webhook configuration.
  </FaqItem>
  <FaqItem title="Do I need the Webhooks add-on to set this up?">
    Yes. You must install the Webhooks add-on in Gravity Forms to configure webhook integrations with AnyTrack.
  </FaqItem>
  <FaqItem title="How do I test my webhook integration?">
    Trigger a test form submission and check the Events Log of your Custom Integration in AnyTrack to verify the event was received correctly.
  </FaqItem>
  <FaqItem title="What parameters does AnyTrack accept from Gravity Forms?">
    Refer to the <a href='/docs/event-attributes'>AnyTrack event attributes documentation</a> for the complete list of supported parameters you can map from your Gravity Forms fields.
  </FaqItem>
</FaqAccordion>
