Smart Banner SDK migration guide
The Adjust Smart Banner SDK is a dedicated tool that enables you to add Adjust smart banners to your website or web app. If you currently serve smart banners and you do not need web attribution, you can use the Smart Banner SDK instead of the full Adjust Web SDK. Follow the instructions in this guide to migrate to Smart Banner SDK.
For more information about the Adjust Smart Banner SDK, see the Smart Banner SDK documentation.
Install the Adjust Smart Banner SDK
Using npm
Before you update your code, you first need to install the Smart Banner SDK. The recommended way to install the SDK is through npm.
$ npm install @adjustcom/smart-banner-sdk --saveOnce you’ve installed the SDK, import it into your project.
import AdjustSmartBanner from "@adjustcom/smart-banner-sdk";Using a CDN
If you’re not using npm, you can install the SDK by loading it through a CDN (Content Delivery Network). The Smart Banner SDK will be available through the global AdjustSmartBanner namespace.
To load the Smart Banner SDK using a CDN, add the following code inside your web page’s <head> tag.
<script type="application/javascript">
!function(n,t,e,o,a,s,r,i,c){var u=a+"_q";n[a]=n[a]||{},n[u]=n[u]||[];for(var d=0;d<s.length;d++)r(n[a],n[u],s[d]);i=t.createElement(e),c=t.getElementsByTagName(e)[0],i.async=!0,i.src="https://cdn.adjust.com/adjust-smart-banner-latest.min.js",i.onload=function(){n[a]=n[a].default;for(var t=0;t<n[u].length;t++)n[a][n[u][t][0]]?n[a][n[u][t][0]].apply(n[a],n[u][t][1]):console.error("No such function found in "+a+": "+n[u][t][0]);n[u]=[]},c.parentNode.insertBefore(i,c)}(window,document,"script",0,"AdjustSmartBanner",["init","show","hide","setLanguage","setIosDeepLinkPath","setAndroidDeepLinkPath","setContext"],(function(n,t,e){n[e]=function(){t.push([e,arguments])}}));
</script>When loading the SDK via a CDN, you should use a minified version for better performance.
- A specific version. For example:
https://cdn.adjust.com/adjust-smart-banner-1.0.0.min.js - The latest version. For example:
https://cdn.adjust.com/adjust-smart-banner-latest.min.js
Uninstall the Adjust Web SDK
Once you’ve installed the Smart Banner SDK, you should remove the existing Web SDK installation. To do this:
- If you load the Web SDK using a CDN, remove the loading snippet from your project.
- If you installed the Web SDK using npm, uninstall the package.
$ npm uninstall @adjustcom/adjust-web-sdkUpdate your code
Once you’ve uninstalled the Web SDK, you can update your existing smart banner logic to use the new SDK. To do this:
- Replace calls to
Adjust.initSmartBannerwithAdjustSmartBanner.init. Check out the Smart Banner SDK initialization options for a full overview of parameters you can pass to the init method. - Replace calls to
Adjust.hideSmartbannerwithAdjustSmartBanner.hide. - Replace calls to
Adjust.showSmartBannerwithAdjustSmartBanner.show. - If you use the
MutationObserversnippet to change banner tracker link, remove or comment it.
That’s it! You’ve successfully integrated the Adjust Smart Banner SDK in your project. You can follow the Smart Banner SDK documentation to change your smart banner settings, customize the positioning of your banners, and more.