Woocommerce Order Tracking

How to track your Woocommerce forms in Ruler Analytics

In order to track WooCommerce form submissions in your Ruler dashboard, there is some additional code required to be placed on the site within your current WooCommerce script.

Locate the functions.php file within your file setup, or within your theme editor (WordPress), once located within your functions.php file, paste in the code from the example below. It's not important where the code is pasted, just make sure that its pasted inside a php tag (<?php).

add_action('woocommerce_thankyou', 'add_ruler_to_thankyou');

function add_ruler_to_thankyou($order_id){
    var order = <?php echo(wc_get_order($order_id))?>;

    var RulerAnalyticsPayload = {
        action: 'convert',
        email : order['billing']['email'],
        firstname: order['billing']['first_name'],
        lastname: order['billing']['last_name'],
        price: order['total'],
        order_id: order['id']

    RulerAnalytics.trackConversion(RulerAnalyticsPayload, "","", 500);


Your orders will now be tracked into Forms within your Ruler account.

If you require any assistance with setting up WooCommerce form tracking, please get in touch with a member of the support team today who will be happy to help.