On Click Event

Track 'clicks' of buttons or links as a form completion event in your Ruler Analytics Account

On your website you may have some interactions that do not require the user to fill in a form, or call up, but may still be worthy of tracking. For example a click of an email address to get in touch, or a click of a button to download a resource.

Please see our guide below on using some additional JavaScript to track these events in your Ruler dashboard.

<script>
   jQuery('a[href="ADDTHEEMAILLINKHERE"]').bind('click touchend', function () {
       function rulerAnalyticsTracker() {
           try {
               if (RulerAnlyticsVisitorId) {
                   var rulerAnalyticsPayload = {
                       action: 'convert',
                       emailclick: 'Feel free to add what you like here i.e general enquiries email click',
                       fromPage: window.location.pathname
                   };
 
                   RulerAnalytics.trackConversion(rulerAnalyticsPayload, '', '', 100);
               }
           } catch (err) {
               setTimeout(function(){
                   rulerAnalyticsTracker();
               }, 500);
           }
       }
       rulerAnalyticsTracker();
   });
</script>

the href= should be replaced with the mailto link within your code on the website that sits beneath the email address. For example. You can find yours by inspecting the element (dev tools) over the email address linked on your website.

In this example it would be [email protected]

521521

And our final code would look something like this

<script>
   jQuery('a[href="mailto:[email protected]"]').bind('click touchend', function () {
       function rulerAnalyticsTracker() {
           try {
               if (RulerAnlyticsVisitorId) {
                   var rulerAnalyticsPayload = {
                       action: 'convert',
                       emailclick: '[email protected]',
                       fromPage: window.location.pathname
                   };
 
                   RulerAnalytics.trackConversion(rulerAnalyticsPayload, '', '', 100);
               }
           } catch (err) {
               setTimeout(function(){
                   rulerAnalyticsTracker();
               }, 500);
           }
       }
       rulerAnalyticsTracker();
   });
</script>

📘

If you require any assistance or have any questions please contact our Support Team