Thank you Page Tracking

Thank you Page Form Tracking

If your form set up is more bespoke, or you are wanting to capture specific data from your forms, then manual form tracking may be the better option for you. Overall, Manual Tracking works by having a JSON object populated by the client through JavaScript, which is then passed through to Ruler by calling some functions (We will go through this further down).

Please note Thank you page tracking will typically require a developer to review and implement the script due to the additional populating required. Any issues let us know.

This tag should only be on the thank you pages that you wish to track a conversion on whether it be a lead, sale or other action. This tag will allow you to match your conversion to the exact source of traffic.

❗️

Important Note

Before you add this tag to your thank you page, it is important that you have checked that the information you are wanting to track is available on the thank you page, this is normal done via passing the data in the URL when redirecting to the thank you page or by pulling through the data from a backend such as PHP.

To integrate the tag, copy and paste the following code to the thank you page, and ensure you populate the fields you are tracking through either passing the information into the url or using other methods like populating through PHP.

Below is an example of how the final thank you page tracking code would look:

<script type="text/javascript">
   window.addEventListener('load',function () {
       function RulerThankYouPageTracking() {
           try {
               if (!RulerAnalyticsVisitorId)
                   throw "Ruler Analytics is not set on the page";
 
               var RulerAnalyticsPayload = {
                   action: "convert",
                   Name: "PopulateWithVariable",
                   Email: "PopulateWithVariable",
               };
 
               RulerAnalytics.trackConversionAsync(RulerAnalyticsPayload,"","",500);
           } catch (error) {
               setTimeout(function () {
                   console.error(error);
                   RulerThankYouPageTracking();
               }, 300);
           }
       }
  		RulerThankYouPageTracking();
   });
</script>

📘

Populating the Script

Variable - This should be the variable you wish to pull from the form on site, such as Email Address, Name, Phone Number etc. You can choose which variables you wish to populate here.

'Populate with Variable' - Please note this requires you to use your websites language to pull the variables from the form submission on your website. Leaving this blank will not pull through your submitted values, examples below.

The RulerAnalyticsPayload object is fully customisable, we just require that the action: ‘convert’ always be available within the object, the object can be populated with a number of methods, below are just some of the common approaches:

Vanilla JavaScript

<script type="text/javascript">
  var RulerAnalyticsPayload = {
    action: 'convert',
    Variable: document.getElementById(‘PopulateWithVariable’).value,
    variable1: document.getElementsByClassName(‘PopulateWithVariable1’)[0].value
  };
</script>

JQuery

<script type="text/javascript">
  var RulerAnalyticsPayload = {
    action: 'convert',
    Variable: $(‘#PopulateWithVariable’).value, 
    variable1: $(‘.PopulateWithVariable1’)[0].value 
  };
</script>

PHP

<script type="text/javascript">
  var RulerAnalyticsPayload = {
    action: 'convert',
    Variable: <?php echo(PopulateWithVariable) ?>, 
    variable1: <?php echo(PopulateWithVariable1) ?>
  };
</script>