使用文档

使用文档

初始化

为了保障用户运营功能可以正常使用,您务必确保用户同意《隐私政策》之后,调用初始化和注册gtcid方法。若不调用注册gtcid方法,用户运营功能无法正常使用。

    // 日志开关
    IdoConfig.setDebugEnable(true)
    // 设置channel
    IdoConfig.setChannel('getui_channel')
    // 预初始化
    Ido.preInit(this.context)
    Ido.setUserId('getui_ido_user')

注册gtcid

Ido.init(this.context).then((gtcId) => {
  hilog.info(0x0000, 'IDOAbility', 'IDO init Succeeded. GtcId: (%{public}s)', gtcId);
})

自定义事件

统计事件

自定义事件可以统计某些用户自定义埋点的发生时间以及次数,例如广告点击、短信数量等。

// 进入主页面
const eventId = "enter_main_page";
Ido.onEvent(eventId);

// 进入支付页面
const eventId = "enter_pay_page";
const map = new Map<string, string | number | Date | boolean>()
map.put("page_from", "active_page");
Ido.onEvent(eventId, jsonObject);

// 进行支付
const eventId = "pay";
const map = new Map<string, string | number | Date | boolean>()
map.put("pay_amount", 100);
map.put("pay_type", "alipay");
Ido.onEvent(eventId, map);

// 点击了广告模块
const eventId = "click_home_ad";
const map = new Map<string, string | number | Date | boolean>()
map.put("ad_id", "ad_001");
map.put("ad_name", "ad_name_001");
Ido.onEvent(eventId, jsonObject);

用户属性事件

设置⽤户属性,用于记录用户基本固定不变的属性,例如性别、年龄、注册时间、注册地域、注册渠道等。

// 设置用户固定属性
const map = new Map<string, string | number | Date | boolean>()
map.put("identify","123456");
map.put("useId","378jkdfjs209afds899");
map.put("sex","male");
map.put("age",20);
map.put("register_time","2024-01-01 00:00:00");
Ido.onProfile(jsonObject);
在这篇文章中: 初始化 注册gtcid 自定义事件

文档中心搜索

技术
咨询

微信扫一扫

随时联系技术支持

在线
咨询