How to include KaiAds in an Angular project

Jiri Richter
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).

  1. Get the KaiAds SDK from https://kaiads.com/publishers/sdk.html (direct download link here: https://www.kaiads.com/KaiAds-SDK.zip)
  2. Unzip the file and put the kaiads.min.js into your Angular app, as src/assets/js/kaiads.min.js
  3. 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.
  4. In your angular.json file, look for “scripts”, and add the kaiads file as:
    “scripts”: [ “src/assets/js/kaiads.min.js” ]
  5. In your tsconfig.json, add “allowJs”: true under “compilerOptions”.
  6. Now, finally, you can use the kaiAds SDK in your component. See the example usage here: https://gist.github.com/Artaud/f7471de582cc03ffc951936c1ffd7fa4

--

--

Jiri Richter
Jiri Richter

Written by Jiri Richter

Dad of 2 boys, programmer. Experience: web (Angular, Ionic, NodeJS + FeathersJS), mobile (Android), wearable (Garmin, Fitbit, Samsung) and stuff here and there.

No responses yet