SDK Integration
Adding the Web SDK to your project involves downloading the Web SDK javascript file and adding it to your Tizen web app.
- Download the latest Web SDK javascript file: kochava.js
- Add the kochava.js file to the js folder of your Tizen web app project.
- Create a script to load and start the SDK
- Call the loadScript function.
function loadScript() {
if (window.kochava) {
console.log('Kochava snippet already included');
return
}
const kochavaScript = document.createElement('script');
kochavaScript.type = 'text/javascript';
kochavaScript.src = 'js/kochava.js';
kochavaScript.async = true;
kochavaScript.onload = function() {
window.kochava.startWithAppGuid('YOUR_APP_GUID');
};
document.head.appendChild(kochavaScript);
}
var init = function() {
// Your initialization job(s)
loadScript();
}
At this point SDK integration is complete and the SDK will begin reporting installs for attribution and measurement purposes.
Optional Web SDK functionality such as measuring events and page views is described within our generic Web SDK usage documentation here: JavaScript Web SDK Integration – Kochava Support
Please notify your Client Success Manager if you encounter any roadblocks or questions specific to your target device or platform which are not covered in the documentation.
Gathering and Transmitting the TIFA
You may optionally gather and transmit the Tizen Identifier for Advertising (TIFA) through the SDK for purposes of measurement and attribution. Follow the steps below to accomplish this; if you are unsure as to whether this is a requirement, please contact your Client Success Manager.
- Before starting the SDK, import Samsung’s AdInfo API with the following script.
- Sleep the SDK prior to start to ensure that no measurement signal is transmitted until the TIFA has been gathered. While sleeping, the SDK will queue, but not transmit any measurement signal.
- Gather the TIFA using the AdInfo API, then register it with the Kochava SDK as a custom device identifier. Wake the SDK to allow queued and future measurement signals to be sent.
<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>
NOTE: More information about the AdInfo API can be found in the AdInfo API Documentation.
Example:
kochava.setSleep(true)
kochava.startWithAppGuid("YOUR-APP-GUID-HERE")
Example:
var TIFA = webapis.adinfo.getTIFA();
kochava.registerCustomDeviceIdentifier('tifa', TIFA)
kochava.setSleep(false);