{"id":20643852,"url":"https://github.com/adjust/smart_banner_sdk","last_synced_at":"2026-03-06T08:32:57.450Z","repository":{"id":166206661,"uuid":"630411233","full_name":"adjust/smart_banner_sdk","owner":"adjust","description":"Adjust Smart Banner SDK","archived":false,"fork":false,"pushed_at":"2025-12-02T11:41:31.000Z","size":1209,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-12-05T08:25:24.300Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adjust.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-20T10:19:09.000Z","updated_at":"2025-12-02T11:38:52.000Z","dependencies_parsed_at":"2025-04-01T22:31:59.363Z","dependency_job_id":"5c6cfa74-d03c-4cda-b7ae-57facf7a5c44","html_url":"https://github.com/adjust/smart_banner_sdk","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/adjust/smart_banner_sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fsmart_banner_sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fsmart_banner_sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fsmart_banner_sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fsmart_banner_sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adjust","download_url":"https://codeload.github.com/adjust/smart_banner_sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adjust%2Fsmart_banner_sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30167963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T16:14:02.672Z","updated_at":"2026-03-06T08:32:57.432Z","avatar_url":"https://github.com/adjust.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Summary\n\nThis is the guide to the Adjust Smart Banner SDK for web sites or web apps. You can read more about Adjust™ at [adjust.com].\n\n## Table of contents\n\n* [Installation](#installation)\n* [Initialization](#initialization)\n* [Hide and show](#visibility)\n* [Localisation](#localisation)\n* [Deeplinks](#deeplinks)\n* [License](#license)\n\n## \u003ca id=\"installation\"\u003eInstallation\u003c/a\u003e\n\nThe recommended way to install the SDK is npm:\n```\nnpm install @adjustcom/smart-banner-sdk --save\n```\n\nAnd then import it into your code:\n```\nimport AdjustSmartBanner from '@adjustcom/smart-banner-sdk'\n```\n\nThe sdk is also available through CDN and then accessible through global `AdjustSmartBanner`.\n\nTo \u003ca id=\"loading-snippet\"\u003eload Smart Banner SDK through CDN\u003c/a\u003e paste the following snippet into the `\u003chead\u003e` tag:\n```html\n\u003cscript type=\"application/javascript\"\u003e\n!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\u003cs.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\u003cn[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])}}));\n\u003c/script\u003e\n```\n\nWhen loading the sdk through CDN we suggest using minified version. You can target specific version like `https://cdn.adjust.com/adjust-smart-banner-1.2.0.min.js`, or you can target latest version `https://cdn.adjust.com/adjust-smart-banner-latest.min.js` if you want automatic updates without need to change the target file. The sdk files are cached so they are served as fast as possible, and the cache is refreshed every half an hour. If you want updates immediately make sure to target specific version.\n\n\n## \u003ca id=\"initialization\"\u003eInitialization\u003c/a\u003e\n\nIn order to initialize the Smart Banner SDK you should call the `AdjustSmartBanner.init` method:\n\n```js\nAdjustSmartBanner.init({\n  appToken: \"APP_TOKEN\",\n})\n```\n\nWhen you call this method Smart Banner SDK detects device platform, and if it's a mobile platform then the SDK loads available smart banners. If a banner for current page exists, it would be shown right after initialisation finished.\n \nHere is the full list of available parameters for the `init` method:\n\n### Mandatory params\n\n#### \u003ca id=\"init-apptoken\"\u003e**appToken**\u003c/a\u003e `string | object`\n\nDepending on what apps you have in your space you provide one or multiple app tokens.\n\nFor multiplatform app pass its app token to initialise the SDK:\n```js\nAdjustSmartBanner.init({\n  appToken: \"APP_TOKEN\",\n})\n```\n\nFor single-platform apps pass app tokens for each platform:\n```js\nAdjustSmartBanner.init({\n  appToken: {\n    ios: \"IOS_APP_TOKEN\",\n    android: \"ANDROID_APP_TOKEN\"\n  }\n})\n```\n\n### Optional params\n\n#### \u003ca id=\"init-loglevel\"\u003e**logLevel**\u003c/a\u003e `string`\n\nBy default this param is set to `error`. Possible values are `none`, `error`, `warning`, `info`, `verbose`. We highly recommend that you use `verbose` when testing in order to see precise logs and to make sure integration is done properly.\nHere are more details about each log level:\n- `verbose` - will print detailed messages in case of certain actions\n- `info` - will print only basic info messages, warnings and errors\n- `warning` - will print only warning and error messages\n- `error` - will print only error message\n- `none` - won't print anything\n\n#### \u003ca id=\"init-language\"\u003e**language**\u003c/a\u003e `string`\n\nYou can instruct the sdk what localisation it should use to display the banner. For further information see [Localisation](#localisation).\n\nExample:\n```js\nAdjustSmartBanner.init({\n  // other initialisation parameters including mandatory ones\n  language: \"fr\"\n})\n```\n\n#### \u003ca id=\"init-deeplink\"\u003e**Deeplink path parameters**\u003c/a\u003e\n\nThese parameters allow you to specify where your user lands in your app when they click on banner. For further information see [Deeplinks](#deeplinks).\n\n##### \u003ca id=\"init-androiddeeplinkpath\"\u003e**androidDeepLinkPath**\u003c/a\u003e `string`\n\nOverrides Android deeplink path, which allows you to change user destination in your mobile app when they click on banner.\n\nExample:\n```js\nAdjustSmartBanner.init({\n  // other initialisation parameters including mandatory ones\n  androidDeepLinkPath: \"android/path/to/screen\"\n})\n```\n\nPlease find [more examples below](#init-context-examples). For further templates and context explanation see [Deeplinks](#deeplinks) chapter.\n\n##### \u003ca id=\"init-iosdeeplinkpath\"\u003e**iosDeepLinkPath**\u003c/a\u003e `string`\nOverrides iOS deeplink path, which allows you to change user destination in your mobile app when they click on banner.\n\nExample:\n```js\nAdjustSmartBanner.init({\n  // other initialisation parameters including mandatory ones\n  iosDeepLinkPath: \"ios/path-to-screen\"\n})\n```\n\nPlease find [more examples below](#init-context-examples). For further templates and context explanation see [Deeplinks](#deeplinks) chapter.\n\n##### \u003ca id=\"init-context\"\u003e**context**\u003c/a\u003e `object`\nSets context for deeplink path template. The context is an object where the SDK searches values to interpolate a deeplink path template. For further information see [Deeplinks](#deeplinks).\n\n\u003ca id=\"init-context-examples\"\u003eExamples:\u003c/a\u003e\n```js\nAdjustSmartBanner.init({\n  // other initialisation parameters including mandatory ones\n  iosDeepLinkPath: \"products/product={item_id}\",\n  context: {\n    item_id: \"cool_jeans_123\"\n  }\n})\n\nAdjustSmartBanner.init({\n  // other initialisation parameters including mandatory ones\n  androidDeepLinkPath: \"products/{item_id}\",\n  context: {\n    item_id: \"cool_jeans_123\"\n  }\n})\n\nAdjustSmartBanner.init({\n  // other initialisation parameters including mandatory ones\n  androidDeepLinkPath: \"products/{item_id}\",\n  iosDeepLinkPath: \"products/product={item_id}\",\n  context: {\n    item_id: \"cool_jeans_123\"\n  }\n})\n```\n\nYou can use different paths for iOS and Android and set different context variables:\n\nExample:\n```js\nAdjustSmartBanner.init({\n  // other initialisation parameters including mandatory ones\n  androidDeepLinkPath: \"promo/{android_promo}\",\n  iosDeepLinkPath: \"main/{ios_promo}\",\n  context: {\n    android_promo: \"new_user\",\n    ios_promo: \"registrationFinished\",\n    unused_variable: \"this will be ignored\"\n  }\n})\n```\n\n#### \u003ca id=\"init-bannerparent\"\u003e**bannerParent**\u003c/a\u003e `HTMLElement`\n\nBy default banner is attached to `document.body`. To change this behaviour you could specify the parent for the banner. It should be an existing `HTMLElement`.\n\n```js\nconst element = document.querySelector('#root-for-banner');\n\nAdjustSmartBanner.init({\n    // other initialisation parameters including mandatory ones\n    bannerParent: element\n})\n```\n\n#### \u003ca id=\"init-oncreated\"\u003e**onCreated**\u003c/a\u003e `function`\n\nA function to be called after banner displayed.\n\n```js\nAdjustSmartBanner.init({\n    // other initialisation parameters including mandatory ones\n    onCreated: () =\u003e console.log('Smart banner shown')\n})\n```\n\n#### \u003ca id=\"init-ondismissed\"\u003e**onDismissed**\u003c/a\u003e `function`\n\nA function to be called when dismiss button of the banner was clicked.\n\n```js\nAdjustSmartBanner.init({\n   // other initialisation parameters including mandatory ones\n    onDismissed: () =\u003e console.log('Smart banner dismissed')\n})\n```\n\n## \u003ca id=\"visibility\"\u003eHide and show\u003c/a\u003e\n\nIt's possible to hide smart banner after initialisation and show it again when needed.\n\n#### \u003ca id=\"visibility-hide\"\u003e**hide**\u003c/a\u003e\n\nHides smart banner. Note: this function does not remove the banner from the DOM.\n\n```js\nAdjustSmartBanner.hide();\n``` \n\n#### \u003ca id=\"visibility-show\"\u003e**show**\u003c/a\u003e\n\nShows smart banner.\n\n**Important**: If your web application is a single page application (SPA) you should call this method after navigation happens and current page URL changes. This forces the SDK to read the updated URL of the page and the SDK can find suitable banners for the current page or use updated GET parameters when it builds a tracker link with a [dynamic deeplink](#deeplinks).\n\n```js\nAdjustSmartBanner.show();\n``` \n\n## \u003ca id=\"localisation\"\u003eLocalisation\u003c/a\u003e\n\nFor better user experience you could localise your smart banners. Smart Banner SDK reads language used in browser, and if there is such localisation of banner, the banner will be displayed in proper language. But default choice might be not the best one, most likely you know better what language your user prefers. In this case you can instruct the sdk what language it should use.\n\nThere are two ways to set preferred language\n - pass it as [a parameter](#init-language) to `AdjustSmartBanner.init`\n - call `setLanguage` setter as shown below:\n\n```js\nAdjustSmartBanner.setLanguage(\"fr\");\n``` \n\nThe setter accepts a two-letters language code, i.e. `en`, `de`, etc.\n\n## \u003ca id=\"deeplinks\"\u003eDeeplinks\u003c/a\u003e\n\nDeeplink is a link which allows to direct user to a certain events or pages in your mobile application, offering a seamless user experience. Smart banner sdk supports [**plain string deeplink paths**](#deeplinks-plain-path) and [**deeplink path templates**](#deeplinks-path-template).\n\nThere are two ways to set a deeplink path or deeplink path template:\n - pass [deeplink path parameters](#init-deeplink) to `AdjustSmartBanner.init` method\n - call [`setAndroidDeepLinkPath`](#deeplinks-setters-androidDeeplinkpath) and [`setIosDeepLinkPath`](#deeplinks-setters-iosDeeplinkpath) setters\n\n### \u003ca id=\"deeplinks-plain-path\"\u003ePlain string deeplink path\u003c/a\u003e\n\nPlain string deeplink path is just a string to be used as a user destination in your mobile app.\n\nExample:\n```js\n// Plain string deeplink path\n\nconst deeplinkPath = \"products/jeans/?product=cool_jeans_123\"\n```\n\n### \u003ca id=\"deeplinks-path-template\"\u003eDeeplink path template\u003c/a\u003e\n\nDeeplink path template is a string which contains placeholders in curly bracets. The sdk replaces the placeholders by the [context values](#deeplinks-setting-context), i.e. interpolates the template. A result of the interpolation is a plain string, which is used as a user destination in your mobile app.\n\nExample:\n```js\n// Deeplink path template\n\nconst template = \"products/{category}/?product={product_id}\"\n\n// Substrings {category} and {product_id} are the placeholders, which are replaced by values found in the context\n```\n\n**Important**: Placeholders in a deeplink template are filled out by the sdk using [provided context](#deeplinks-setting-context) or [GET parameters](#deeplink-context-urlparams) of the current web page URL.\n\n#### \u003ca id=\"deeplinks-setting-context\"\u003eContext for deeplink path template\u003c/a\u003e\n\nContext is used to interpolate [deeplink path templates](deeplinks-path-template).\n\nThere are two ways to provide context programmatically:\n - pass context as a [deeplink context parameter](#init-context) to `AdjustSmartBanner.init`\n - call [`setContext` setter](#deeplinks-setters-context)\n\nAnother way to setup context is to use [GET parameters](#deeplink-context-urlparams).\n\nBefore deeplink path template interpolation the sdk reads GET parameters of current URL address and combines them with the programmatically passed context. If there are a GET parameter and a context property with the same name, the sdk prefers and stores the value appeared in the context.\n\nThen the sdk looks through the deeplink path template and replaces the placeholders enclosed in curly brackets with the properties from the combined context. If there is no such property in the combined context, then an empty string inserted instead of a placeholder.\n\n#### \u003ca id=\"deeplink-context-urlparams\"\u003e**Using GET parameters as context**\u003c/a\u003e\n\nTo interpolate deeplink path templates, the sdk reads the GET parameters of the current URL address and combines them with the programmatically set context.\n\nExample:\n```js\n// Let's say the current URL is \"https://my-shop.com/?product_id=111222\u0026promo=spring_10\"\n\nAdjustSmartBanner.setIosDeepLinkPath(\"products/{product_id}/?promo={promo}\");\n\n// Then resulting deeplink path is \"products/111222/?promo=spring_10\"\n```\n\nYou could combine the methods to setup the context:\n```js\n// Let's say the current URL is \"https://my-shop.com/?product_id=111222\u0026promo=spring_10\"\n\nAdjustSmartBanner.setIosDeepLinkPath(\"products/{category}/{product_id}/?promo={promo}\");\n\n// But wait, there is no value for {category} in the GET parameters\n\nAdjustSmartBanner.setContext({ category: \"jeans\" });\n\n// Then resulting deeplink path is \"products/jeans/111222/?promo=spring_10\"\n```\n\n**Important**: if your web app is a single page applications (SPA) you should call `AdjustSmartBanner.show()` when page address changes since the sdk on its own is unable to track navigation events and retrieve an updated URL.\n\n**Important**: the [context](#deeplinks-setting-context) passed programmatically to the sdk is a prior choice to fill in the placeholders, and GET parameters with the same keys are ignored in favor of the context.\n\nExample:\n```js\n// Let's say the current URL is \"my-shop.com/?product_id=111222\", so we have product_id parameter in the GET parameters\n\nAdjustSmartBanner.setIosDeepLinkPath(\"products/{product_id}/\");\n\n// And then setContext function is called, which overrides a value of product_id\nAdjustSmartBanner.setContext({ product_id: \"999888\" });\n\n// Then resulting deeplink path is \"products/999888/\"\n```\n\n### \u003ca id=\"deeplink-setters\"\u003e**Deeplink path and context setters**\u003c/a\u003e\n\nThere are several functions to set custom deeplink path or deeplink path template and its context.\n\n#### \u003ca id=\"deeplinks-setters-androidDeeplinkpath\"\u003e**setAndroidDeepLinkPath**\u003c/a\u003e\n\nAccepts a string representing deep link path or deeplint path template.\n\nExample:\n```js\nAdjustSmartBanner.setAndroidDeepLinkPath(\"products/jeans/?product=111222\u0026promo=spring_10\")\n```\n\nA deeplink path template could contain any number of placeholders enclosed in curly brackets.\n\nExample:\n```js\nAdjustSmartBanner.setAndroidDeepLinkPath(\"products/jeans/?product={product_id}\u0026promo={promo_id}\")\n```\n\nThe sdk will replace these parameters with values from [context](#init-context) provided within initialisation or with [setContext](#deeplinks-setters-context) function, or from [URL parameters](#deeplink-context-urlparams).\n\n#### \u003ca id=\"deeplinks-setters-iosDeeplinkpath\"\u003e**setIosDeepLinkPath**\u003c/a\u003e\n\nAccepts a string representing deep link path or deeplint path template.\n\nExample:\n```js\nAdjustSmartBanner.setIosDeepLinkPath(\"products/jeans/?product=111222\u0026promo=spring_10\")\n```\n\nA deeplink path template could contain any number of placeholders enclosed in curly brackets.\n\nExample:\n```js\nAdjustSmartBanner.setIosDeepLinkPath(\"products/jeans/?product={product_id}\u0026promo={promo_id}\")\n```\n\nThe sdk will replace these parameters with values from [context](#init-context) provided within initialisation or with [setContext](#deeplinks-setters-context) function, or from [URL parameters](#deeplink-context-urlparams).\n\n\n#### \u003ca id=\"deeplinks-setters-context\"\u003e**setContext**\u003c/a\u003e\n\nAn object with data to fill placeholders in deeplink template. The sdk searches a placeholder among the keys of passed context and replaces the placeholder with according value.\n\nExample:\n```js\nAdjustSmartBanner.setAndroidDeepLinkPath(\"products/{category}/{product_id}/?promo={promo}\");\nAdjustSmartBanner.setContext({\n  category: \"jeans\",\n  product_id: \"111222\",\n  promo: \"spring_10\"\n});\n\n// Resulting deeplink path is \"products/jeans/111222/?promo=spring_10\"\n```\n\n **Important**: if there is no such key in `context` found the sdk will try to get value from GET parameters of current URL address. Then if it's unable to find a value to be filled in, placeholder is replaced with an empty string.\n\nExample:\n```js\nAdjustSmartBanner.setIosDeepLinkPath(\"products/{category}/{product_id}/?promo={promo}\");\nAdjustSmartBanner.setContext({ category: \"jeans\" });\n\n// Resulting deeplink path is \"products/jeans//?promo=\"\n```\n\n **Important**: Note that `setContext` overrides the last preserved context, instead of sequential calls you should combine all needed parameters in a single object and then call `setContext` with it.\n\n Example:\n```js\n// Wrong\nAdjustSmartBanner.setIosDeepLinkPath(\"products/{category}/{product_id}\");\nAdjustSmartBanner.setContext({ category: \"jeans\" });\nAdjustSmartBanner.setContext({ product_id: \"111222\" }); // Previous context is lost\n\n// Resulting deeplink path is \"products//111222\", {category} is replaced with an empty string\n\n// Correct\nAdjustSmartBanner.setIosDeepLinkPath(\"products/{category}/{product_id}\");\nAdjustSmartBanner.setContext({\n  category: \"jeans\",\n  product_id: \"111222\"\n});\n\n// Resulting deeplink path is \"products/jeans/111222\"\n```\n\n## \u003ca id=\"license\"\u003eLicense\u003c/a\u003e\n\nThe Adjust SDK is licensed under the MIT License.\n\nCopyright (c) 2023 Adjust GmbH, https://www.adjust.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n[adjust.com]:   https://adjust.com\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadjust%2Fsmart_banner_sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadjust%2Fsmart_banner_sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadjust%2Fsmart_banner_sdk/lists"}