The Branch Web SDK for deep linking and attribution. Once initialized, the Branch Web SDK allows you to create and share links with a banner (web only), over SMS, or your own methods by generating deep links. It also offers event tracking, access to referrals, and management of credits.
This allows a user to set a global callback function for all API requests, once each response is received, including any errors, such as timeouts. This records each attempt in the case of retries.
Using this function right away requires adding setAPIResponseCallback to the JS snippet that imports the SDK in order to avoid a race asynchronously loading the SDK. See changes to onpage.js.
With some requests I get null for the status argument. Still looking into that. For jsonp requests (as opposed to XHR requests), the request is made via an async script tag. For these endpoints (/_r and /v1/deepview), no status code is available, so that argument is always undefined (not null, as originally indicated).
Also working on unit tests. May not get this finished today.
You can immediately test this locally:
Run make to rebuild the dist folder.
Edit example.html and add the call above to branch.setAPIResponseCallback before branch.init.
In example.html, also add setAPIResponseCallback to the list of functions:
This allows a user to set a global callback function for all API requests, once each response is received, including any errors, such as timeouts. This records each attempt in the case of retries.
Using this function right away requires adding
setAPIResponseCallback
to the JS snippet that imports the SDK in order to avoid a race asynchronously loading the SDK. See changes to onpage.js.With some requests I getFor jsonp requests (as opposed to XHR requests), the request is made via an async script tag. For these endpoints (null
for thestatus
argument. Still looking into that./_r
and/v1/deepview
), no status code is available, so that argument is alwaysundefined
(notnull
, as originally indicated).Also working on unit tests. May not get this finished today.You can immediately test this locally:
make
to rebuild the dist folder.branch.setAPIResponseCallback
beforebranch.init
.setAPIResponseCallback
to the list of functions: