URL Parameters Thank You Page Conversion Event
Tracking Form Submissions Using URL Parameters
Overview
If your form submission passes information through the URL to a thank-you page, you can use the pre-built Ruler script below to automatically capture those URL parameters and send them to Ruler as a form conversion.
This can be a simple way to implement thank-you page tracking when your form provider already passes the submitted values into the thank-you page URL.
For example:
https://example.com/[email protected]&form_type=contact
The script will read the parameters from the URL and send them to Ruler as part of the conversion.
NoteThis method captures the URL parameters as they are provided. It does not allow you to selectively choose or customise which parameters are sent to Ruler. The parameters available to capture are determined by your form and how it is configured.
Before You Start
Before implementing this method, confirm that your form passes the required information to the thank-you page URL.
The exact configuration will depend on your form builder or form provider. We recommend contacting your form provider or reviewing their necessary help docs if you need assistance configuring URL parameters or redirect behaviour.
For example, your form may redirect a successful submission to:
https://example.com/[email protected]&phone=07123456789
The Ruler script will then capture the parameters:
email = [email protected] = 07123456789
and send them to Ruler as a conversion event in your reports.
Add the URL Parameter Tracking Script
Add the following JavaScript to your thank-you page:
<script type="text/javascript">
var retryCount = 0;
function rulerConversion() {
try {
var searchParams = window.location.search;
var queryParams = searchParams.substring(1).split("&");
var RAConv = {};
queryParams.forEach(function (param) {
var keyValues = param.split("=");
if (keyValues.length >= 2) {
RAConv[decodeURIComponent(keyValues[0])] =
decodeURIComponent(keyValues.slice(1).join("="));
}
});
RulerAnalytics.trackConversionAsync(RAConv, "", "", 200);
} catch (error) {
if (retryCount <= 10) {
retryCount++;
setTimeout(rulerConversion, 200);
}
}
}
window.addEventListener("load", rulerConversion);
</script>The script will:
- Read the parameters from the current page URL.
- Convert the parameters into a Ruler conversion payload.
- Send the captured values to Ruler.
- Retry the conversion if the Ruler tracking script has not loaded yet.
Using Google Tag Manager
You can also implement this script through Google Tag Manager (GTM) as a Custom HTML tag.
When implementing the script through GTM:
- Create a new Custom HTML tag.
- Paste the URL parameter tracking script into the HTML field.
- Create or select a trigger that targets your thank-you page.
- Ensure the trigger does not fire across all page views.
- Save and publish your GTM container.
- Test a form submission to confirm the conversion is being sent to Ruler.
Preventing Inflated Conversion Data
This script is a conversion tracker. Each time it runs, it can signal a form conversion to Ruler.
For this reason, it should only be placed on thank-you pages that represent a successful form submission.
Incorrect implementation can result in conversions being recorded when a form has not actually been submitted, which can inflate your conversion metrics.
For example, avoid triggering the script on:
- Your homepage
- Standard website pages
- The form page itself
- Thank-you pages that can be accessed without submitting a form such as Order review pages
You should also consider whether a visitor can refresh or revisit the thank-you page, as this may cause the conversion script to run again depending on your implementation.
🚧 Important: Test the complete form journey before going live. Confirm that the conversion is recorded when the form is successfully submitted and that the tracking script does not fire on unrelated page views.
Need Help?
If you're unsure how to configure your form to pass URL parameters, we recommend first contacting your form provider or developer.
If you need assistance implementing the Ruler conversion tracker or validating your setup, please contact a member of the Ruler team.
Updated 4 days ago