웹앱에 Adrop SDK 설치하기 (Dprecated)


1. Adrop 앱키 추가하기

설정 파일 준비하기 가이드를 참고해 주세요.

2. 앱에 Adrop 라이브러리 추가

CDN에서 Adrop SDK 라이브러리를 로드합니다. 이 스크립트를 복사하여 <head> 태그 하단에 붙여넣으세요.

<head>
    ...
    <script src='https://storage.adrop.io/js/adrop-0.2.2.min.js' type='text/javascript'></script>
    <script>adrop = window.adrop || {}</script>
</head>

3. Adrop 초기화하기

Example App

  1. 사용하기 전에 파라미터를 등록된 AppKey로 바꿔주세요. 등록된 AppKey는 다음 페이지를 참고해 확인할 수 있어요.

adrop.initialize('YOUR_APP_KEY')
  1. 만약 Typescript를 사용한다면, 하단의 코드를 복사해 *.d.ts 에 붙여넣으세요.

declare var adrop: {
    initialize: (appKey: string) => void;
    request: (unitId: string) => Promise<{ 
        ad: string,
        unit: string,
        message: string,
        creativeId: string,
        headline?: string,
        body?: string,
        destinationURL?: string
        profile?: { displayName: string, displayLogo: string, link: string }
        extra?: { id: string, text: string }[]
        asset?: string
    }>;
    setProperty: (key: string, value: any) => Promise<void>;
    logEvent: (name: string, params?: Record<string, any>) => Promise<void>;
}

3. 만약 ESLint를 사용한다면, .eslintrc.json globals 필드에 "adrop": true를 추가해주세요.

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

Last updated