SDK Installation
Angular 2+

Get Started

5min

Inject SDK Script

Add the following line to your src/index.html before </head> or </body>

JS


We recommend loading the SDK with the async flag so your page load times don't increase.

Add Cooee App ID

We recommend that you store the App ID in your environment files. For that, you can add cooeeAppID in all your environment.ts files.

TypeScript


Replace MY_COOEE_APP_ID with the App ID which is present at Cooee Portal.

After you are done with testing, since the SDK should only collect analytics in your production website, we recommend that you remove cooeeAppID value from environment.ts and only add to your environment.prod.ts file.

Add CooeeService

In your Angular project, add this generic service src/services/cooee.service.ts -

TypeScript


This is a generic example of using Cooee in your Angular application.

Now, in your app.component.ts (or somewhere in any global code), initialize the service-

JS




Updated 25 Mar 2024
Did this page help you?