Common API

    Common API


    Article summary

    AccessKey Settings

    Set the issued accessKey.

    late final _shopLiveCommonPlugin = ShopLiveCommon();
    _shopLiveCommonPlugin.setAccessKey(accessKey: String?)


    User Authentication

    Easy Authentication

    void setUser({required String accessKey, required ShopLiveCommonUser user})to store user information.

    ShopLiveCommonUser

    Property name

    Type

    Description

    userId

    String

    A value that ensures the uniqueness of a logged-in user (Required)

    name

    String?

    User name

    age

    Int?

    User age

    gender

    ShopLiveCommonUserGender?

    User gender

    userScore

    Int?

    Integers are available from -100 to 100.

    custom

    Map<String, dynamic>?

    Any data can be set up to 1KB.  It allows checking the total/login viewers' data.

    late final _shopLiveCommonPlugin = ShopLiveCommon();
    _shopLiveCommonPlugin.setUser(
        accessKey: "accessKey",
        user: ShopLiveCommonUser(
          userId: "userId",
          userName: "TestUser",
          userScore: 0,
          gender: ShopLiveCommonUserGender.NEUTRAL,
          age: 20,
          custom: {"key": "value"},
        ));

    JWT Certification

    void setAuthToken({required String? userJWT})Authenticate through the ShopLive JWT.

    late final _shopLiveCommonPlugin = ShopLiveCommon();
    _shopLiveCommonPlugin.setAuthToken(userJWT: String)

    Reset credentials

    Initialize the credentials that have been set.

    late final _shopLiveCommonPlugin = ShopLiveCommon();
    _shopLiveCommonPlugin.clearAuth()

    Marketing funnel tracking

    You can track UTM tags (Source/Medium/Campaign/Content) using the following functions: The logged information can be found in Data Insights.

    • void setUtmSource({required String? utmSource})

    • void setUtmMedium({required String? utmMedium})

    • void setUtmCampaign({required String? utmCampaign})

    • void setUtmContent({required String? utmContent})

    Parameter name

    Type

    Description

    utmSource

    String?

    Communicate where the influx came from.

    utmMedium

    String?

    Communicate how the influx occurred. Google recommends setting the medium parameter to refer to the marketing method that led to the inflow. (e.g. cpc, banner, email, blog, social etc.)

    utmCampaign

    String?

    It tells you which ad campaign generated the inflow. It can be divided into Campaign Name, Campaign Term, and Campaign Content.

    utmContent

    String?

    It will tell you what kind of post/advertisement the influx was caused by. It is often used as a subdivision of campaign parameters.

    Sample code

    late final _shopLiveCommonPlugin = ShopLiveCommon();
    _shopLiveCommonPlugin.setUtmSource(utmSource: "utm_source")
    _shopLiveCommonPlugin.setUtmMedium(utmMedium: "utm_medium")
    _shopLiveCommonPlugin.setUtmCampaign(utmCampaign: "utm_campaign")
    _shopLiveCommonPlugin.setUtmContent(utmContent: "utm_content")