Filters

Web Basic Integration

👍

SDK Stats

Open Source Github Repo: https://github.com/BranchMetrics/web-branch-deep-linking
SDK Size: 50kb
Speed: Median 80ms to 250ms

🚧

iOS 14 Intelligent Tracking Prevention Warning

On iOS 14 in Safari, you likely will see 'branch.io' listed as blocked by Safari with the new visibility. Note that this is expected, and simply means that cookies from branch.io are blocked. No web functionality or tracking will be affected. We use a different domain for managing our cookies.

Requirements

The Branch Web SDK requires native browser JavaScript and has been tested in all modern browsers with sessionStorage capability. No 3rd party libraries are needed to make use of the Branch Web SDK, as it is 100% native JavaScript.

Browser Specific Support

ChromeFirefoxSafariIE
9, 10, 11

Configure Branch

Initialize Branch

To initialize the Branch Web SDK, include the following script in your <head> HTML element:

<!doctype html>
<html>
   <head>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title></title>
      <script>
         // load Branch
         (function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener banner closeBanner closeJourney data deepview deepviewCta first init link logout removeListener setBranchViewData setIdentity track trackCommerceEvent logEvent disableTracking getBrowserFingerprintId crossPlatformIds lastAttributedTouchData setAPIResponseCallback qrCode setRequestMetaData setAPIUrl getAPIUrl setDMAParamsForEEA".split(" "), 0);
         // init Branch
         branch.init('key_live_YOUR_KEY_GOES_HERE'); // Change `key_live_YOUR_KEY_GOES_HERE` to match your Branch Dashboard
      </script>
   </head>
   <body></body>
</html>

Tips:

  • Make sure to change the value of key_live_YOUR_KEY_GOES_HERE in the script to match your Branch Dashboard.
  • If you'd like to use a specific version of the Branch Web SDK, point to https://cdn.branch.io/branch-x.xx.x.min.js (e.g. https://cdn.branch.io/branch-2.47.1.min.js) rather than https://cdn.branch.io/branch-latest.min.js when initializing.
  • You can also use bower install branch-sdk or npm install branch-sdk to get the Branch Web SDK.

🚧

Escaped Keys & Values

Journeys link data (data returned from Journeys event handlers) in WebSDK versions <= 2.48.0 will now contain escaped keys and values. Characters targeted for escaping include ", ', &, <, and >. These characters will be escaped to their corresponding HTML entities. Additionally URLs, in both keys and values will be URI encoded.

Developers using WebSDK >= 2.49 will notice values in Journeys link data become escaped with the same rules as above. Keys will not be escaped.


Recommended Next Steps