How to Remove Test Form Submissions from Analytics Data

Most marketing teams submit ongoing test forms to ensure their follow-up flows are working, receiving leads, and configuring tracking. As a result, conversion data across your marketing platforms can include test form submissions. ListenLayer allows you to quickly identify test form submissions based on characteristics of the form field values. Next, write rules that push custom values into your data layer when a test form is submitted and then use Google Tag Manager to exclude it from your tracking.

Create & Manage Custom Data Layer Rules that Identify and Filter Our Test Form Conversions

You can finally clean up your conversion data across marketing platforms by automatically identifying test form submissions and excluding them from your tracking using Google Tag Manager. Let’s walk through the simple steps to completing this!

Steps & Code Examples

Step 1: Add Your Domain Name Inside ListenLayer
Step 1: Add Your Domain Name Inside ListenLayer

Navigate to the Website screen of your ListenLayer account and add your website domain name. Then copy the Website Script to place on your website using Google Tag Manager.

Step 2: Deploy Your ListenLayer Website Script
Step 2: Deploy Your ListenLayer Website Script

Create a Custom HTML Tag inside of Google Tag Manager that fires on All Pages. Place the tracking script from your ListenLayer account. A sample is shown here, but you must use the code from your account, not this example code!

<script type="text/javascript">(function(c,a,d,b,e) {c[b] = c[b] || [];
c=a.getElementsByTagName(d)[0];a=a.createElement(d);b="dataLayer"!= b ?"&l="+b:"";a.async = !0;
a.src = "https://assets.listenlayer.com/datalayer.min.js?id="+e+b;
c.parentNode.insertBefore(a,c)})(window,document,"script","dataLayer",
"00000000-0000-0000-0000-0000000000000");</script>
Step 3: Enable Your Listener & Features
Step 3: Enable Your Listener & Features

Before you can filter our test form submissions, you’ll need to ensure that you’re using one of ListenLayer’s form Listeners to monitor form activity on your website and automatically generate data into the data layer.  To do this, enable the form Listener for your application (in this example, we are using Hubspot Forms) and then turn on Activity Features.

Don’t forget to publish your changes inside ListenLayer.

Step 4: Turn on Data Layer Customization
Step 4: Turn on Data Layer Customization

You’ll also need to prepare to customize the values inside of your data layer using rules that you write inside of ListenLayer. To do this, enable the “Custom Data Layer Values” Feature of your Listener. A new “Custom Values” menu item will appear in the Listener’s menu once the Feature is enabled.

Step 5: Define Your Custom Variable to Identify Test Form Submissions
Step 5: Define Your Custom Variable to Identify Test Form Submissions

To identify our test form submissions, we will write a rule that pushes a specific value into the data layer when a test form submission occurs.  To begin, create your custom data layer variable inside of the Global Settings in your ListenLayer account.

In this example, we’re creating a new variable called testConversion. We can use this variable across other Listeners, such as Chat Listeners, to easily filter out test chats as well.

testConversion
Step 6: Write Your Custom Data Layer Rules
Step 6: Write Your Custom Data Layer Rules

Next, navigate to the Custom Values section of your Listener and create a new Simple Rule. Name your rule and then begin to build your condition sets. When the condition is met, the system will push a custom value into the data layer.

In the example shown, we want to push a custom value into the data layer whenever hsFormSubmitted is true (meaning a HubSpot form is submitted) and the User’s Email field includes the phrase “test.” Watch the full case study video to learn more about how to identify and use automatic variables from inside your data layer.

Step 6: Define Your Custom Data Layer Value
Step 6: Define Your Custom Data Layer Value

After building out the condition, you can now choose the custom data layer variable that you would like to push a value into (when the condition is met), and then you can define the actual value to push. You can push hardcoded text values or use values from other variables.

We will simply put a one into the testConversion field when our condition is met in our example. The result is this: whenever a HubSpot form is submitted with the phrase “test” in the email field, we will push a one into the testConversion data layer variable allowing us to quickly write an exclusion trigger in Google Tag Manager.

At this point, it’s crucial that you publish your ListenLayer change and then test your data layer!

Step 7: Make Your Variable Available to GTM
Step 7: Make Your Variable Available to GTM

Once our new data layer variable is working, we need to configure it inside Google Tag Manager. Do this by creating a new variable, selecting Data Layer Variable as the Type, and entering the path to the variable into the Event name field. Watch the full video to understand more about paths.

Step 8: Create Your Exclusion Trigger in GTM
Step 8: Create Your Exclusion Trigger in GTM

Now we can create a trigger in GTM that will serve as an exclusion. In our example, we want the trigger to apply whenever a HubSpot form is submitted (data layer event = hsFormSubmitted), and our new data layer variable (testConversion) contains 1.

Step 9: Apply Exclusion to Form Conversion Tags
Step 9: Apply Exclusion to Form Conversion Tags

With our exclusion tag created, we simply add it to all of our conversion tags that fire on form submissions. Then, preview or publish your GTM changes to test your results!