首页 > 用户手册 > 开发者文档 > 前后端sdk打通

前后端sdk打通(基于用户cookie)

1.步骤一:

接入前端JS-SDK

接入JS-SDK文档

2.步骤二:

接入后端SDK

接入JAVA-SDK文档

接入PHP-SDK文档

接入C++-SDK文档

3.步骤三:

获取JS-SDK种下的cookie,通过后端SDK发送数据

以php为例

获取id代码:

print_r($_COOKIE);//打印cookie

返回结果:

Array(
[dgt_mapurl_542] => http://www.shujike.com/
[dgt_appid_542] => 19
[PHPSESSID] => 53d740ddd39c45e7fdb6509145821ba4c8a5c4f4
[dgt_platform_4488] => 0
[_dg_attr_d3deb0f9d3bdded2_cf0c] => {"userid":"542","a_telephone":"18202259700","a_SDK_state":"%E5%B7%B2%E5%AE%89%E8%A3%85"}
[intercom-id-blsfd5aw] => 1738b126-9ad5-4ca5-a050-dcf0545fdc62
[Hm_lvt_43594c2b00f4318e1ce8221b71c03ec0] => 1521602926
[Hm_lpvt_43594c2b00f4318e1ce8221b71c03ec0] => 1521603026
[dgt_platform_5904] => 5
[dgt_platform_542] => 4
[Hm_lvt_a7984c77a568b94455cb5f80ee41dbf8] => 1523523498
[_dg_id_f50df72669faa866_cf0c] => fe339760fb2f0ff7|||1516536760|||1|||1523866389|||1523864934||||||703b19ab75f665b2|||||||||0|||undefined
[ci_session] => c393b1c479142a8055b6690da6ac6b133dc56704
[Hm_lpvt_a7984c77a568b94455cb5f80ee41dbf8] => 1524125816
[_dg_check_d3deb0f9d3bdded2_cf0c] => -1
[_dg_playback_d3deb0f9d3bdded2_cf0c] => -1
[_dg_id_d3deb0f9d3bdded2_cf0c] => 1e83c0339c56af19|||1509604243|||2|||1524125829|||1524125829||||||a6c353881988a13d|||||||||0|||{"utm_source":"测试","utm_campaign":"测试","utm_medium":"","utm_content":"","utm_term":""})
  • 需要获取的是最后一行'_dg_id_d3deb0f9d3bdded2_cf0c'的值。 该key的规则为 '_dg_id_'+app_code+ '_'+4位随机码,建议通过正则获取该key的value。

  • 整个value中,我们需要的是从最开始到第一个‘|||’ 之间的16位随机码,这个就是用来打通前后端SDK的用户cookie,在上面例子中,cookie为‘1e83c0339c56af19’,后文将这个cookie称为sjk_id。

4.步骤四:

将获取到的sjk_id通过后端埋点set到 firstPartyCookie 字段中,即可与前端同一sjkid产生的事件打通

results matching ""

    No results matching ""