Skip to content

Commit

Permalink
Merge private/master into v520
Browse files Browse the repository at this point in the history
  • Loading branch information
Yara Matkova committed Aug 4, 2021
2 parents c6faa4c + 743299a commit 9910664
Show file tree
Hide file tree
Showing 45 changed files with 4,666 additions and 1,596 deletions.
10 changes: 8 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"space-before-function-paren": ["error", "always"],
"quotes": ["error", "single"],
"prefer-arrow-callback": "error",
"prefer-object-spread": "error"
"prefer-object-spread": "error",
"flowtype/no-types-missing-file-annotation": "off"
},
"overrides": [
{
Expand All @@ -42,7 +43,12 @@
"plugins": ["@typescript-eslint"],
"rules": {
"semi": ["error", "never"],
"space-before-function-paren": ["error", "never"],
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"eol-last": "error",
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/explicit-module-boundary-types": "off"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 5.2.0 (3rd August 2021)
#### Added
- [beta] Smart banners.

---

### Version 5.1.2 (11th June 2021)
#### Added
- Added Typescript support.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Our sdk is exposed under all module definitions, so it works under CommonJS and
To lazy <a id="loading-snippet">load the Adjust Web SDK through CDN</a> paste the following snippet into the `<head>` tag:
```html
<script type="application/javascript">
!function(t,a,e,r,s,l,d,n,o){t.Adjust=t.Adjust||{},t.Adjust_q=t.Adjust_q||[];for(var c=0;c<l.length;c++)d(t.Adjust,t.Adjust_q,l[c]);n=a.createElement("script"),o=a.getElementsByTagName("script")[0],n.async=!0,n.src="https://cdn.adjust.com/adjust-latest.min.js",n.onload=function(){for(var a=0;a<t.Adjust_q.length;a++)t.Adjust[t.Adjust_q[a][0]].apply(t.Adjust,t.Adjust_q[a][1]);t.Adjust_q=[]},o.parentNode.insertBefore(n,o)}(window,document,0,0,0,["initSdk","trackEvent","addGlobalCallbackParameters","addGlobalPartnerParameters","removeGlobalCallbackParameter","removeGlobalPartnerParameter","clearGlobalCallbackParameters","clearGlobalPartnerParameters","switchToOfflineMode","switchBackToOnlineMode","stop","restart","gdprForgetMe","disableThirdPartySharing"],function(t,a,e){t[e]=function(){a.push([e,arguments])}});
!function(t,a,e,r,s,n,l,d,o){t.Adjust=t.Adjust||{},t.Adjust_q=t.Adjust_q||[];for(var c=0;c<n.length;c++)l(t.Adjust,t.Adjust_q,n[c]);d=a.createElement("script"),o=a.getElementsByTagName("script")[0],d.async=!0,d.src="https://cdn.adjust.com/adjust-latest.min.js",d.onload=function(){for(var a=0;a<t.Adjust_q.length;a++)t.Adjust[t.Adjust_q[a][0]].apply(t.Adjust,t.Adjust_q[a][1]);t.Adjust_q=[]},o.parentNode.insertBefore(d,o)}(window,document,0,0,0,["initSdk","trackEvent","addGlobalCallbackParameters","addGlobalPartnerParameters","removeGlobalCallbackParameter","removeGlobalPartnerParameter","clearGlobalCallbackParameters","clearGlobalPartnerParameters","switchToOfflineMode","switchBackToOnlineMode","stop","restart","gdprForgetMe","disableThirdPartySharing","initSmartBanner"],function(t,a,e){t[e]=function(){a.push([e,arguments])}});
</script>
```

The Adjust Web SDK should be loaded only once per page and it should be initiated once per page load.

When loading the sdk through CDN we suggest using minified version. You can target specific version like `https://cdn.adjust.com/adjust-5.1.2.min.js`, or you can target latest version `https://cdn.adjust.com/adjust-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.
When loading the sdk through CDN we suggest using minified version. You can target specific version like `https://cdn.adjust.com/adjust-5.2.0.min.js`, or you can target latest version `https://cdn.adjust.com/adjust-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.

It's also possible to install our sdk through NPM:

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.2
5.2.0
39 changes: 37 additions & 2 deletions dist/adjust-latest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ interface EventParams {
partnerParams?: Array<GlobalParams>;
}

type LogLevel = 'none' | 'error' | 'warning' | 'info' | 'verbose'

interface InitOptions {

/** Required to initialise SDK instance, please make sure to provide valid app token. */
Expand Down Expand Up @@ -128,7 +130,7 @@ interface InitOptions {
* - `error` - will print only error message
* - `none` - won't print anything
*/
logLevel?: 'none' | 'error' | 'warning' | 'info' | 'verbose';
logLevel?: LogLevel;

/**
* Optional. Query selector to define html container if you want to see your logs directly on the screen. This could
Expand Down Expand Up @@ -290,6 +292,38 @@ function gdprForgetMe(): void
*/
function disableThirdPartySharing(): void

interface SmartBannerOptions {

/** Web token to initialise Smart Banner */
webToken: string;

/** Optional. Logging level used by SDK instance. By default this param is set to `error`. We highly recommend that
* you use `verbose` when testing in order to see precise logs and to make sure integration is done properly.
* Here are more details about each log level:
* - `verbose` - will print detailed messages in case of certain actions
* - `info` - will print only basic info messages, warnings and errors
* - `warning` - will print only warning and error messages
* - `error` - will print only error message
* - `none` - won't print anything
*/
logLevel?: LogLevel;
}

/**
* Initiate Smart Banner.
*
* This method gets Smart Banner data and creates Smart Banner UI.
*
* @param {SmartBannerOptions} options Options to initiate Smart Banner.
*
* @example
* Adjust.initSmartBanner({
* webToken: 'YOUR_WEB_TOKEN',
* logLevel: 'verbose'
* });
*/
function initSmartBanner(options: SmartBannerOptions): void

const Adjust = {
initSdk,
trackEvent,
Expand All @@ -304,7 +338,8 @@ const Adjust = {
stop,
restart,
gdprForgetMe,
disableThirdPartySharing
disableThirdPartySharing,
initSmartBanner,
}

export default Adjust
Loading

0 comments on commit 9910664

Please sign in to comment.