Conversion tracking

    Conversion tracking


    Article summary

    You can track conversion events through the scripts provided by ShopLive. When a purchase meets the conditions below, it would be counted as a conversion.

    • A user watches a live (or replay) or short-form video for at least 3 seconds

    • Purchased products were also displayed on a live (or replay) or short-form video

    • the purchase happened within a maximum of 28 days from the date the user watches the product listed in the video

    Conversion is based on the last video the user watched, and live (replay) and short-form are recorded separately. So, if a purchase occurs, it will be recorded as a purchase conversion in both live (replay) and short-form respectively If the user watched both.


    sendConversionEvent

    The sendConversionEvent() function used on the purchase completion page records the purchase event using the product identifier of the purchased item as the key information. It maps this information to viewing data to record the correlation between viewing and purchasing.

    For logged-in users, the function recognizes the user of viewing and purchasing through user authentication, similar to the viewing process. For users who are not logged in, it links viewing and purchasing using the user identifier stored in local storage.

    ShopLiveConversionData

    Property name

    Type

    Description

    type

    String?

    ‘purchase’ (Required)

    products

    List<ShopLiveConversionProductData>?

    List of purchased products

    orderId

    Int?

    Order ID for a purchased product

    referrer

    String?

    Referrer

    custom

    Map<String, Any>?

    Additional custom field

    ShopLiveEvent.sendConversionEvent(data: ShopLiveConversionData(type: "purchase",
                               products: [
                                ShopLiveConversionProductData(productId: "productId",
                                               customerProductId: "customerProductId",
                                               sku: "sku",
                                               url: "url",
                                               purchaseQuantity: 1,
                                               purchaseUnitPrice: 1000.0)
                               ],
                               orderId: "orderId" ,
                               referrer: "referrer",
                               custom: ["campaignKey" : "campaignKey"])
    )


    User authentication

    userId

    It is used to authenticate users through commonly used user authentication functions and link purchase/viewing data.

    ShopLiveCommon.setUser(user: ShopLiveCommonUser?)
    ShopLiveCommon.setAuthToken(userJWT: String?)

    anonId

    This is an anonymous ID that can be used to track purchase conversions. If you manage an identification value such as a device ID separately, you can enter this value as anonId to associate viewing/purchase data without user authentication. If you don't have a value to manage, you don't have to use it.

    ShopLiveCommon.setAnonId(anonId: String?)


    Purchased products

    A list of purchased products is used for tracking purchase conversions.

    ShopLiveConversionProductData

    An object describing the contents of a purchased product.

    Property name

    Type

    Description

    productId

    String?

    Shoplive-side product ID

    customerProductId

    String?

    Customer-side product ID

    sku

    String?

    Product sku

    url

    String?

    Product url link

    purchaseQuantity

    Int?

    Number of purchases (if not filled in, it will be counted as 1)

    purchaseUnitPrice

    Double?

    Purchase price (use the price of the registered product when not filled)