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.

//Your snippet found at  https://dashboard.attributionapp.com/goto/settings/instructions
<script type="text/javascript">
!function(){var Attribution=window.Attribution=window.Attribution||[];if(!Attribution.initialize)if(Attribution.invoked)window.console&&console.error&&console.error("Attribution snippet included twice.");else{Attribution.invoked=!0,Attribution.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"],Attribution.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);return t.unshift(e),Attribution.push(t),Attribution}};for(var t=0;t<Attribution.methods.length;t++){var e=Attribution.methods[t];Attribution[e]=Attribution.factory(e)}Attribution.load=function(t,e){var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src="https://scripts.attributionapp.com/v2/attribution.js";var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(i,r),e=e||{},e.projectId=t,Attribution._loadOptions=e},Attribution.SNIPPET_VERSION="4.1.0";

  Attribution.load("YOUR PROJECTID HERE");
  Attribution.page();
}}();
</script>

<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>