抖音开放平台Logo
开发者文档
“/”唤起搜索
控制台
  • JS API 列表
  • 基础
  • TTML
  • 网络
  • 媒体
  • 地图
  • 文件
  • 数据缓存
  • 地理位置
  • 设备
  • 画布
  • 界面
  • 页面导航
  • 开放接口
  • 登录
  • 用户信息
  • 广告
  • 营销能力
  • 支付
  • 分享
  • 小程序跳转
  • 抖音视频能力
  • 收货地址
  • 设置
  • 授权
  • 评价能力
  • 数据分析
  • 视频拍摄器
  • 引导关注
  • 订阅消息
  • 电商插件能力(即将废弃)
  • 隐私信息授权
  • web化
  • 转发和挂载
  • 侧边栏能力
  • 直播能力
  • tt.openWebcastRoom
  • tt.createLiveReportContext
  • tt.getRoomInfo
  • tt.getLiveUserInfo
  • tt.getSelfCommentCountDuringPluginRunning
  • tt.isFollowingAnchor
  • LiveReportContext
  • 直播间关注互动数据
  • 直播间评论互动数据
  • AI/AR能力
  • 安全能力
  • 行业开放
  • 第三方平台
  • 其它
  • 生活服务(即将废弃)
  • tt.createLiveReportContext
    收藏
    我的收藏

    该接口已停止维护,后续将逐步下线,不建议使用。
    基础库 2.29.0 开始支持本方法,这是一个同步方法。
    警告
    此接口将逐步废弃,后续不再维护,请及时修改下线,避免影响小程序使用
    用于直播间小程序埋点上报。

    语法

    tt.createLiveReportContext()

    返回值

    返回 LiveReportContext 对象

    代码示例

    // utils.js const noop = () => {}; const defaultReporter = { productSelect: noop, productDetailsShow: noop, productShareClick: noop, shelfShow: noop, orderConfirmPageShow: noop, orderSubmit: noop, }; export const liveReport = tt.canIUse("createLiveReportContext") ? tt.createLiveReportContext() : defaultReporter;
    // page.js const { liveReport } = require("utils.js"); Page({ onShow() { liveReport.productDetailsShow({ productId: "商品id", productName: "商品名称", shopId: "商家id", shopName: "商家名称", success: () => { console.log("上报成功"); }, fail: ({ errMsg }) => { console.log("上报失败:", errMsg); }, }); }, });

    Bug & Tip

      •Tip: 开发者工具暂不支持此能力,请用真机扫码调试。
    ​