1212
1313### <a id =" plugin-build-for " > This SDK is built for
1414
15- - <img src =" https://github.com/AppsFlyerSDK/AppsFlyerSDK-appsflyer-html5-ctv-sdk/blob/main/images/tizen.png?raw=true " alt =" drawing " width =" 15 " /> Samsung Tizen
16- - <img src =" https://github.com/AppsFlyerSDK/AppsFlyerSDK-appsflyer-html5-ctv-sdk/blob/main/images/lg.png?raw=true " alt =" drawing " width =" 15 " /> LG Webos
15+ - <img src =" https://github.com/AppsFlyerSDK/AppsFlyerSDK-appsflyer-html5-ctv-sdk/blob/main/images/tizen.png?raw=true " alt =" drawing " width =" 15 " /> Samsung (Tizen 4 & above)
16+ - <img src =" https://github.com/AppsFlyerSDK/AppsFlyerSDK-appsflyer-html5-ctv-sdk/blob/main/images/lg.png?raw=true " alt =" drawing " width =" 15 " /> LG (Webos 4 & above)
17+ - VIZIO & Vidaa. [ Please follow the implementation guide] ( /docs/other-platforms.md )
18+
1719
1820 ## 📖 Guides
1921- [ Adding the SDK to your project] ( #installation )
2224- [ Platforms dependecy] ( #platform-dependency )
2325 - [ Samsung] ( #samsung )
2426 - [ LG] ( #lg )
25- - [ Initializing the SDK] ( #integration )
26- - [ Launch event] ( #launch )
27- - [ In-app Events] ( #inappevents )
28- - [ Testing the integration] ( #testing )
29- - [ Response codes] ( #response-codes )
30- - [ Sample App] ( #demo )
27+ - [ Support for other platforms] ( /docs/other-platforms.md )
28+ - [ Basic implemantation of the SDK] ( #integration )
29+ - [ API] ( /docs/api.md )
30+ - [ AppsFlyerSDK initialization] ( /docs/api.md#newAppsflyerSdk )
31+ - [ Start] ( /docs/api.md#start )
32+ - [ In-app events] ( /docs/api.md#inappevents )
33+ - [ Set custom payload] ( /docs/api.md#setCustomPayload )
34+ - [ Set customer user Id] ( /docs/api.md#setCustomerUserId )
35+ - [ Init (Deprecated!)] ( /docs/api.md#init )
36+ - [ Testing the integration] ( /docs/testing.md )
37+ - [ Logs] ( /docs/testing.md#logs )
38+ - [ Response codes] ( /docs/testing.md#response-codes )
39+ - [ Sample App] ( /docs/testing.md#demo )
3140
3241
3342#
@@ -52,7 +61,7 @@ Download the appsflyerSdk.bundle.js file from [here](dist/appsflyerSdk.bundle.js
5261<script src="[bundle-js-location]"></script>
5362```
5463
55- ## <a id =" platform-dependency " > Platforms dependecy
64+ ## <a id =" platform-dependency " > Platform dependency
5665
5766In order for the SDK to fetch device data from the relevant platform, make sure to follow the following instructions:
5867
@@ -82,120 +91,31 @@ In order for the SDK to fetch device data from the relevant platform, make sure
8291<script type="text/javascript" src="[webOSTVjs-1.2.4-directory]"></script>
8392```
8493
85-
86- ## <a id =" integration " > 🚀 Initializing the SDK
94+ ## <a id =" integration " > 🚀 Basic implemantation of the SDK
8795
8896Initialize the SDK to enable AppsFlyer to detect installations, sessions (app opens) and updates.<br >
8997
9098``` javascript
9199import AppsFlyerSDK from ' appsflyer-html5-ctv-sdk'
92100
93- let appsflyer = new AppsFlyerSDK () ;
101+ let appsflyer;
94102let config = {
95103 devKey: " RxutGo4bSB9MKkM7bMCjHP" ,
96104 appId: " 3202204027284" ,
97105 isDebug: true ,
98106 isSandbox: false
99107}
100108
101- await appsflyer .init (config);
102-
103- ```
104-
105- | Setting | Description |
106- | -------- | ------------- |
107- | devKey | Your application [ devKey] ( https://support.appsflyer.com/hc/en-us/articles/207032066-Basic-SDK-integration-guide#retrieving-the-dev-key ) provided by AppsFlyer (required) |
108- | appId | [ App ID] ( https://support.appsflyer.com/hc/en-us/articles/207377436-Adding-a-new-app#available-in-the-app-store-google-play-store-windows-phone-store ) you configured in your AppsFlyer dashboard (required) |
109- | isDebug | Show Debug logs - set to ` true ` for testing only! |
110- | isSandbox | Send events to sandbox endpoints - set to ` true ` for testing only! |
111-
112-
113- ## <a id =" launch " > Launch event
114-
115- ``` javascript
116- appsflyer .start ()
117- .then ((response )=> {
118- console .log (" start API response success: " + JSON .stringify (response));
119- }).catch ((err )=> {
120- console .log (" start API response err: " + JSON .stringify (err));
121- });
122- ```
123-
124-
125- ## <a id =" inappevents " > In-app events
126-
127- ** <a id =" logEvent " > ` logEvent(String eventName, Object eventValues) ` **
128-
129- | parameter | type | description |
130- | ----------- | ----------| ------------------------------------------ |
131- | eventName | String | The event name, it is presented in your dashboard. |
132- | eventValues | Object | The event values that are sent with the event. |
133-
134- ``` javascript
135- appsflyer .logEvent (" af_purchase" , {" af_revenue" : 1.99 , " af_currency" : " USD" })
136- .then ((response )=> {
137- console .log (" logEvent API response success: " + JSON .stringify (response));
138- }).catch ((err )=> {
139- console .log (" logEvent API response err: " + JSON .stringify (err));
140- });
141- ```
142-
143- ## <a id =" testing " > Testing the integration
144-
145- - In order to check a succesful integration of the AppsFlyer SDK, please enable ` isDebug ` option to ` true ` ;
146-
147- - The following request should be sent:
148-
149- ```
150- // launch request:
151-
152- AppsFlyerSDK :: Sending start request
153- AppsFlyerSDK :: https://events.appsflyer.com/v1.0/c2s/session/app/tizen/3202204027284
154- AppsFlyerSDK :: {"device_ids":[{"type":"custom","value":"c6577bb9-d4d1-4adf-809e-c3abf7c76b58"}],"limit_ad_tracking":true,"device_model":"UKS9000","device_os_version":"5.0","customer_user_id":"15667737-366d-4994-ac8b-653fe6b2be4a","app_version":"1.0.5","request_id":"aa64ea40-6cda-4fde-b4c5-31f600e1b50f","timestamp":1662035187532}
155-
156- // logEvent request:
157- AppsFlyerSDK :: Sending logEvent request
158- AppsFlyerSDK :: https://events.appsflyer.com/v1.0/c2s/inapp/app/tizen/3202204027284
159- AppsFlyerSDK :: {"device_ids":[{"type":"custom","value":"c6577bb9-d4d1-4adf-809e-c3abf7c76b58"}],"limit_ad_tracking":true,"device_model":"UKS9000","device_os_version":"5.0","customer_user_id":"15667737-366d-4994-ac8b-653fe6b2be4a","app_version":"1.0.5","request_id":"c55bb0fe-fed5-4c02-8e5d-c6031f56ecaf","timestamp":1662035187534,"event_name":"af_purchase","event_parameters":{"af_revenue":1.99,"af_currency":"USD"}}
160-
161- ```
162-
163-
164- - Check the response code is 202/200
165-
166- ```
167- AppsFlyerSDK :: start request success with status code: 202 Message: Success
168- AppsFlyerSDK :: logEvent request success with status code: 202 Message: Success
169- ```
170-
171- ### <a id =" response-codes " > Response codes
172-
173- | response code | description |
174- | ----------- | ------------------------------------------ |
175- | 200/202 | Successful |
176- | 400 | In case the authentication succeeded, if any of the mandatory fields in the message body are missing, or if any of the fields are invalid|
177- | 401 | If the app doesn’t exist or the authentication failed |
178- | 403 | In case app traffic should be blocked due to Zero package limit |
179- | 404 | network error |
180-
181- ## <a id =" demo " > Sample app
182-
183- Try our demo app!
184-
185- 1 . Clone the repo
186-
187- 2 . Comment/uncomment the relevant config file for the relevant platform in example/main.js (LG/SAMSUNG)
188-
189- 3 . Execute the following:
190-
191- ``` bash
192- $ yarn buildDev
193- ```
194-
195- Open and run the following directory from your emulator/simulator or real device:
196-
197- ```
198- appsflyer-html5-ctv-sdk/example/app
199- ```
200-
201- ![ demo printscreen] ( https://github.com/AppsFlyerSDK/AppsFlyerSDK-appsflyer-html5-ctv-sdk/blob/main/images/demo.png?raw=true )
109+ try {
110+ appsflyer = await new AppsFlyerSDK (config);
111+ }catch (e){
112+ console .log (" AppsFlyerSDK initialization failed. Error " + e);
113+ }
114+
115+ try {
116+ let response = await appsflyer .start ();
117+ console .log (" start API response success: " + JSON .stringify (response));
118+ }catch (err){
119+ console .log (" start API response err: " + JSON .stringify (err));
120+ }
121+ ```
0 commit comments