How to track Paid Acquisition Campaigns with Pico

When running paid acquisition to direct new sign-up or subscribers to your site through Facebook or Google, it's possible to track the effectiveness of the campaign. This allows you to stop targeting users that have already subscribed to Pico through the campaign, and measure an accurate return on ad spend (ROAS) from your campaigns.

This is an advanced integration, and requires javascript development, though we have a code example below. This relies on Signals, to identify when site visitors have converted to registered contacts or paying subscribers, in combination with a browser cookie to only send the conversion event once. 

  1. You'll need to create an element that has the PicoSignal class, in the code snippet's example, this is on a div.
  2. Add the code snippet below to your site. In this example, both Facebook and Google conversion tracking code is shown. Others can be included in the fireTrackingEvents() method. To track events against Google Analytics, you'll need to have GA code installed on your site elsewhere. Where it says {your-pixel-id-goes-here} within the Facebook code, replace with your pixel id from Facebook as defined:

var adCampaignPicoHandler = function(){
    var REGISTERED_EVENT_CAPTURED = "ad-reg-event-captured";
      var PAID_EVENT_CAPTURED = "ad-paid-event-captured";
      function setCookie(name,value,days) {
        var expires = "";
        if (days) {
          var date = new Date();
          date.setTime(date.getTime() + (days*24*60*60*1000));
          expires = "; expires=" + date.toUTCString();
        document.cookie = name + "=" + (value || "")  + expires + "; path=/";
      function getCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
          var c = ca[i];
          while (c.charAt(0)==' ') c = c.substring(1,c.length);
          if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        return null;
      function fireTrackingEvents(){
         //Other Tracking events can go here.
     function fireGAevent(){
        ga('send', 'event', event);
      function fireFBevent(){
         s.parentNode.insertBefore(t,s)}(window, document,'script',
       fbq('init', '{your-pixel-id-goes-here}');
       fbq('trackSingleCustom', '{your-pixel-id-goes-here}', event);
      var element = document.querySelector('div.PicoSignal');
      var event = null
      var observer = new MutationObserver(function(mutations) {
        var hasSentRegistered = getCookie(REGISTERED_EVENT_CAPTURED);
        var hasSentPayment = getCookie(PAID_EVENT_CAPTURED);
        mutations.forEach(function(mutation) {
          if (mutation.type == "attributes" && mutation.attributeName == "data-pico-status") {
            if(element.getAttribute("data-pico-status") == "registered" && !hasSentRegistered){
            event = "Registered"
            else if(element.getAttribute("data-pico-status") == "paying" && !hasSentPayment){
             event ="Paying"
      observer.observe(element, {
        attributes: true
    window.addEventListener('pico.loaded', adCampaignPicoHandler)

For help setting up a Facebook or Google campaign to direct more traffic to your site, please reach out to Pico Support and we'll put you in contact with our partners.

Did this answer your question?