How to track a form submission

Learn how to track a form submission event.

In this article, we will go through various ways to collect form submissions and send tracking events to AnyTrack.

If you do not need to send customer data or matching parameters to your ad platforms, you can enable the "catch all" form tracking event from your property settings.

This feature only works if your form emits a form submission to the browser.

Prerequisites

  • The form should be a standard HTML form (wrapped in a <form> tag).
  • The form should not be in an <iframe>. 
    If your form is in an iframe, follow this article as an example
  • You must add an input type hidden field with a default value set as --CLICK-ID-- or {click_id}

Native Integration with lead generation platforms

We did the hard work for you. Easily connect with one of the many platforms found in our integration  👉 catalog.  New integrations are continually added.

If your platform is not in our Integration Catalog continue with the steps below.

Two methods to track form submissions:

  1. Fire the AnyTrack Custom Event Snippet on the Thank You Page.
  2. Fire the AnyTrack webhook from your CRM or Form provider.

The Thank You Page

The classic Thank You page is the easy option as you'll just have to place the following tag on the thank you page. 

Basic Tracking Snippet

Copy/paste this javascript snippet on your Thank you page.

<script>
// trigger a Lead event
var click_id = AnyTrack('trigger', 'Lead');
</script>

Advanced Tracking Snippet

If the lead data is exposed via the browser datalayer, then you can enrich the conversion event with additional parameters which will be used to improve attribution and create custom audiences.

<script>
// trigger a Lead event
var click_id = AnyTrack('trigger', 'Lead', {
   value: '10', //replace with dynamic value
   currency: 'USD', //replace with dynamic value or set a static value
 fullName: 'Jared Newman', //replace with dynamic value
 email: 'jared@anytrack.io', //replace with dynamic value
label: 'promo name', //replace with dynamic value
transactionId: 'submissionid' //replace with dynamic value to deduplicate submissions
});
</script>

Note: While this method is effective, we highly recommend using the server side tracking method.

Server Side Tracking (webhook)

The server-side tracking method is the most reliable method to track any type of events, whether leads, purchases or others,  as it allows you to better control the data you send to to your ad platforms via AnyTrack Conversion API.

The requirements for server-side tracking

  • Your platform must be able to send notifications via HTTP requests or webhooks.
  • Your form should support hidden fields.

Getting started

  1. Navigate to the integration catalog and add a custom integration (search Custom)
  2. Give it a name and URL and click next
  3. Now add some dummy values to the fields and save.
  4. Now copy the Webhook/ Postback URL
  5. Edit your Form
  6. Add a hidden field: The AnyTrack tracking tag will search for this token and substitute it with a unique value:
    1. Field Name: click_id
    2. Default value: --CLICK-ID--
  7. Configure your Form to make an HTTP POST request to the Integration Webhook URL

The URL should look like:

https://t1.anytrack.io/XXX/collect/custom

You can append either query string parameters or a JSON file

{
"click_id": "BFC2w7sGG9GMRXfkSTZUXIz36Mk9m2X9B9", //clickid passed to the form
"event_name": "Lead", //You can update the name as you see fit.
"event_value": 25, //update accordingly
"currency": "USD", //update accordingly
"brand_name": "My Form Name" //update accordingly
}