API: Common

    API: Common


    Article summary

    AccessKey setting

    Set the issued accessKey.

    ShopLiveCommon.setAccessKey(accessKey : String?)

    User authentication

    Simple Authentication

    With the ShopLiveCommon.setUser(user: ShopLiveCommonUser)or ShopLiveCommon.setUser(user: ShopLiveCommonUser, accessKey: String?), you can store user information. Refer to the User Authentication Guide for details.

    • When user information is saved, a userJWT is automatically created and stored using the user’s information.

    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

    πŸ“˜/γ…‘γ…œ/       

    In the Objective-C environment, use the ShopLiveCommonUserObjc object.

    JWT Authentication

    With the ShopLiveCommon.setAuthToken(authToken: String), you can use ShopLive JWT authentication.

    ShopLiveCommon.setAuthToken(jwt : String)

    Clear authentication information

    Reset the configured authentication information.

    ShopLiveCommon.clearAuth()

    Logged-in check

    Determine if JWT login has occurred.

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

    Set Utm tag

    You can track UTM Source/Medium/Campaign/Content. The data can be reviewed in the Data Insights.

    • 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?

    It provides information on where the incoming traffic originated.

    utmMedium

    String?

    It conveys how the incoming traffic was generated. Google recommends setting the medium parameter to denote the marketing method through which the traffic was induced, such as CPC, banner, email, blog, social, etc.

    utmCampaign

    String?

    It communicates which advertising campaign the incoming traffic originated from. This can be divided into Campaign Name, Term, and Content.

    utmContent

    String?

    It informs about the posting/advertisement that led to the incoming traffic, often utilized as a subcategory under the campaign parameter.

    Sample code

    ShopLiveCommon.setUtmSource(β€œ{utm_source}”)
    ShopLiveCommon.setUtmMedium(β€œ{utm_medium}”)
    ShopLiveCommon.setUtmCampaign(β€œ{utm_campaign}”)
    ShopLiveCommon.setUtmContent(β€œ{utm_content}”)