API - Common

    API - Common


    기사 요약

    AccessKey 설정

    발급받은 AccessKey를 설정합니다.

    ShopLiveCommon.setAccessKey(accessKey : String?)


    사용자 인증

    간편 인증

    ShopLiveCommon.setUser(user: ShopLiveCommonUser)또는 ShopLiveCommon.setUser(user: ShopLiveCommonUser, accessKey: String?)을 통해 사용자 정보를 저장합니다. 자세한 내용은 사용자 인증 가이드를 참조하세요.

    • 사용자 정보를 저장하면 자동으로 user의 정보를 가지고 userJWT를 만들어서 저장합니다.

    ShopLiveCommon.setuser(user : ShopLiveCommonUser,accessKey:String?)

    ShopLiveCommonUser

    Property name

    Type

    Description

    userId

    String

    User ID

    name

    String?

    User Name (Used in the chat window)

    age

    Int?

    User age

    gender

    ShopliveCommonUserGender

    User gender

    userScore

    Int?

    User rating

    custom

    [String: Any]

    Custom data

    Objective-C 환경에서는 ShopLiveCommonUserObjc 객체를 사용해주시기 바랍니다.

    JWT 인증

    ShopLiveCommon.setAuthToken(authToken: String)를 통해 ShopLive JWT 인증합니다.

    ShopLiveCommon.setAuthToken(jwt : String)

    ShopLiveCommon.getAuthToken()->String?를 통해 ShopLive에 있는 JWT 인증합니다. 만약 JWT 인증을 하지 않고 일반 인증을 했을 때도 생성된 토큰 정보를 가져옵니다.

    ShopLiveCommon.getAuthToken() -> String?

    인증 정보 초기화

    설정된 인증 정보를 초기화합니다.

    ShopLiveCommon.clearAuth()

    로그인 확인

    JWT 로그인 여부를 파악합니다.

    if ShopLiveCommon.isLoggedIn() {
      // Do something
    }


    마케팅 유입 경로 추적

    다음의 함수들을 통해 UTM 태그(Source/Medium/Campaign/Content)를 트래킹할 수 있습니다. 로깅된 정보는 데이터 인사이트에서 확인할 수 있습니다.

    • ShopLiveCommon.setUtmSource(utmSource: string)

    • ShopLiveCommon.setUtmMedium(utmMedium: string)

    • ShopLiveCommon.setUtmCampaign(utmCampaign: string)

    • ShopLiveCommon.setUtmContent(utmContent: string)

    func setUtmSource(utmSource: String?)
    func setUtmMedium(utmMedium: String?)
    func setUtmCampaign(utmCampaign: String?)
    func setUtmContent(utmContent: String?)

    Parameter name

    Type

    Description

    utmSource

    String?

    해당 유입이 어디에서 발생하였는지를 전달해줍니다.

    utmMedium

    String?

    해당 유입이 어떻게 발생하였는지를 전달해줍니다. 구글은 medium 파라미터를 유입이 유도된 마케팅 방식을 지칭하도록 세팅하는 것을 권장하고 있습니다. (ex. cpc, banner, email, blog, social etc.)

    utmCampaign

    String?

    어떤 광고의 캠페인으로 유입이 발생하였는지를 전달해줍니다. Campaign Name, Campaign Term, Campaign Content로 나눠서 만들 수 있습니다.

    utmContent

    String?

    해당 유입이 어떤 내용을 가진 포스팅/광고에 의해서 발생하였는지를 전달해줍니다. 주로 campaign 파라미터의 하위 구분으로 자주 활용됩니다.

    userScore

    Int?

    User rating

    custom

    [String: Any]

    Custom data

    Sample code

    ShopLiveCommon.setUtmSource(“{utm_source}”)
    ShopLiveCommon.setUtmMedium(“{utm_medium}”)
    ShopLiveCommon.setUtmCampaign(“{utm_campaign}”)
    ShopLiveCommon.setUtmContent(“{utm_content}”)