Unbounce

How to integrate Unbounce and Attribution

Unbounce is a powerful tool for creating landing pages and gathering new leads. Attribution can easily be integrated with Unbounce by adding the tracking snippet below in your Unbounce script manager.

❗️

Adjust projectId

Please be sure to adjust the Attribution Project ID parameter in the code below

Steps to integrate Unbounce & Attribution

  1. Go to your Settings → Script Manager in Unbounce
  2. Click "Add a Script"
  3. Select Custom Script in What would you like to add? and use "Attribution" as name.
  4. Paste the code below into the "Script Details" and Placement – Head, Included on – All.
  5. Change the ATTRIBUTION_PROJECT_ID parameter to what you find your Attribution Settings → Integration Instructions.
  6. In "Script Usage" make sure to select the domains you want to track.

Once that is complete you will start to see Unbounce leads coming through as conversion events with the title Unbounce Form Submitted.

Please feel free to reach out to [email protected] if you have any questions or concerns.

// Place your snippet here found at
// https://dashboard.attributionapp.com/goto/settings/instructions

<script type="text/javascript">
!function() {
  var callback = function(event) {
    var engine = (window.Attribution || window.analytics);
    var traits = {};
    var inputs = event.formElement.elements;

    for (i = 0; i < inputs.length; i++) {
      var name = inputs[i].name;
      var value = inputs[i].value;

      if ( // skip empty or reserved inputs
        name.match(/^(page|ub)/) ||
        name == '' ||
        name == undefined ||
        value == '' ||
        value == undefined
      ) {
        continue;
      }

      // work_email, business_email, etc...
      if (name.match(/email/)) {
        name = 'email';
      }

      traits[name] = value;
    }
    
    if (engine) {
      engine.identify(traits);
      engine.track('Unbounce Form Submitted', {
        unbounce_page: ub.page.name,
        unbounce_variant: ub.page.variantId
      });
    } else {
      console.log('[Attribution] Snippet not found');
    }
  };
  
  if (window.ub && window.ub.hooks) {
    window.ub.hooks.beforeFormSubmit.push(callback);
  } else {
    console.log('[Attribution] Unbounce page not detected');
  }
}();
</script>