How to include KaiAds in an Angular project
1 min readOct 2, 2019
For anyone who’s been trying to get a KaiOS project published, the simplest way to get it monetized would currently be KaiAds.
It hasn’t been really a rosegarden walk when I tried to add it to my KaiOS Angular app, so I figured I’d put together a walkthrough.
I assume you have an Angular project already so I won’t concern with initializing it (there’s a lot of good tutorials on that already).
- Get the KaiAds SDK from https://kaiads.com/publishers/sdk.html (direct download link here: https://www.kaiads.com/KaiAds-SDK.zip)
- Unzip the file and put the kaiads.min.js into your Angular app, as src/assets/js/kaiads.min.js
- Open up the kaiads.min.js file and add export on the very beginning, so it reads as
export const getKaiAd = ((…e)
and so on. - In your angular.json file, look for “scripts”, and add the kaiads file as:
“scripts”: [ “src/assets/js/kaiads.min.js” ] - In your tsconfig.json, add “allowJs”: true under “compilerOptions”.
- Now, finally, you can use the kaiAds SDK in your component. See the example usage here: https://gist.github.com/Artaud/f7471de582cc03ffc951936c1ffd7fa4