Web

Before you begin

If you haven't already, add Adrop to Web and make sure that Adrop Metrics is enabled in your project

Initiailze Adrop

  1. Please replace the parameter with appropriate values before using it.

adrop.initialize('YOUR_APP_KEY')
  1. If you're using Typescript, copy this code in your *.d.ts

declare var adrop: {
    initialize: (appKey: string) => void;
    request: (unitId: string) => Promise<{ ad: string, unit: string}>;
    setProperty: (key: string, value: string) => Promise<void>;
    logEvent: (name: string, params: Record<string, any>) => Promise<void>;
}

3. If you're using ESLint, add "adrop": true to globals field in your .eslintrc.json

{
   "globals": {
      "adrop": true
   }
}

Log Events

You can log custom event to define the users of your app.

await adrop.logEvent("event_name", {
    "data_key_1": 1,
    "data_key_2": 1.2,
    "data_key_3": true,
    "data_key_4": "value_text"
})

Last updated