Skip to main content

Track Facebook within UTMSimple and trigger Events

You can track Facebook easily and accurately within UTMSimple without using Facebook's own pixel tracking. Details are available here: Facebook Conversion Tracking.

Usage is straightforward. You only need to know your pixel ID and add it to your tracking code as follows: create a variable named fb_pixel_id and assign your pixel ID to it. The code will look like this:

<!-- Global site UTM Simple Tracking Start -->
<script>
    fb_pixel_id = "<YOUR FB PIXEL ID>";
    handl_custom_params = [];
    var handl_js = document.createElement("script");
    handl_js.setAttribute("src", "https://track.utmsimple.com/utm.js?license=<LICENSE KEY>");
    document.head.appendChild(handl_js);
    handl_js.onload = function() {
        /* This is the UTM Simple ready event. You can put any code you'd like to trigger after the script fully loads here. */
    };
</script>
<!-- Global site UTM Simple Tracking End -->

After that, our script will initialize the Facebook pixel and collect all the data for Facebook.

If you want to trigger certain events for Facebook (such as Lead, Add To Cart, Purchase, etc.), you can use the following code:

HandL.sendFBEvent('InitiateCheckout');
HandL.sendFBEvent('Lead', {value: 1, currency: 'USD'});
HandL.sendFBEvent('Purchase', {value: '##total_amount##', currency: 'USD'}, {eventID: '<event_id>'});

By following these steps, you'll effectively track Facebook events using UTMSimple.