buqiu/sensors 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

buqiu/sensors

Composer 安装命令:

composer require buqiu/sensors

包简介

上报神策数据

README 文档

README

Description

神策数据SDK

Software Architecture

神策数据上报

添加 composer.json

    "require": {
        "buqiu/sensors": "^1.0"
    }, 
    
    "repositories": [
        {
            "type": "git",
            "url": "https://gitee.com/buqiu-community/sensors.git"
        }
    ],

安装

composer require buqiu/sensors

composer install

配置 config/app.php

'providers' => [
    Buqiu\Sensors\SensorsProvider::class
],

发布配置

php artisan vendor:publish --tag=buqiu-sensors-config

env配置上报日志的绝对路径

SENSORS_LOG_PATH="/home/Helix/www/helixlife/v4/helixlife-platforms/blog/storage/logs"

参数含义

$action : 字符串类型,上报事件或上报用户属性;【track:事件记录追踪,profileSet:用户属性设置,profileSetOnce:用户属性初始化,profileIncrement:属性自增,profileAppend:追加属性,bind:绑定,unbind:解绑】
$identityList : 数组类型,上报唯一身份;【user_uuid:用户uuid(必填),identity_mp_unionid: 微信的unionid (有就上报,无则置空),identity_cookie_id: 神策生成的唯一身份id (有就上报,无则置空)】
$properties:数组类型,事件属性,或用户属性
$common:数组类型,公共用户属性,(事件上报必填,用户属性上报可置空为数组)
$event:字符串类型,上报的事件名,(上报事件必填,用户属性上报则为空)

如何使用

track 事件上报

use Buqiu\Sensors\Sensors;

$action ='track';
$identityList=['user_uuid'=>'3b5513c8-552d-466b-b362-42de7b6bbf66245','identity_mp_unionid'=>'','identity_cookie_id'=>''];
$properties=['city'=>'上海'];
$common=['ip'=>'111'];
$event='RegisterSuccess';

$sensors = new Sensors($action, $identityList, $properties, $common, $event);
$sensors->executeAction();

profileSet 用户属性上报

use Buqiu\Sensors\Sensors;

$action ='profileSet';
$identityList=['user_uuid'=>'3b5513c8-552d-466b-b362-42de7b6bbf66245','identity_mp_unionid'=>'','identity_cookie_id'=>''];
$properties=['ip'=>'上海'];
$common=[];
$event='';

$sensors = new Sensors($action, $identityList, $properties, $common, $event);
$sensors->executeAction();

profileSetOnce 属性初始化

use Buqiu\Sensors\Sensors;

$action ='profileSetOnce';
$identityList=['user_uuid'=>'3b5513c8-552d-466b-b362-42de7b6bbf66245','identity_mp_unionid'=>'','identity_cookie_id'=>''];
$properties=['source'=>'PC'];
$common=[];
$event='';

$sensors = new Sensors($action, $identityList, $properties, $common, $event);
$sensors->executeAction();

profileIncrement 属性自增

use Buqiu\Sensors\Sensors;

$action ='profileIncrement';
$identityList=['user_uuid'=>'3b5513c8-552d-466b-b362-42de7b6bbf66245','identity_mp_unionid'=>'','identity_cookie_id'=>''];
$properties=['GamePlayed'=>1];
$common=[];
$event='';

$sensors = new Sensors($action, $identityList, $properties, $common, $event);
$sensors->executeAction();

profileAppend 追加属性

use Buqiu\Sensors\Sensors;

$action ='profileAppend';
$identityList=['user_uuid'=>'3b5513c8-552d-466b-b362-42de7b6bbf66245','identity_mp_unionid'=>'','identity_cookie_id'=>''];
$properties=['Games'=>["Call of Duty", "Halo"]];
$common=[];
$event='';

$sensors = new Sensors($action, $identityList, $properties, $common, $event);
$sensors->executeAction();

bind 绑定

use Buqiu\Sensors\Sensors;

$action ='bind';
$identityList=['user_uuid'=>'3b5513c8-552d-466b-b362-42de7b6bbf66245','identity_mp_unionid'=>'','identity_cookie_id'=>'','$identity_mobile'=>'123'];
$properties=[];
$common=[];
$event='';

$sensors = new Sensors($action, $identityList, $properties, $common, $event);
$sensors->executeAction();

unbind 解绑

use Buqiu\Sensors\Sensors;

$action ='unbind';
$identityList=['user_uuid'=>'3b5513c8-552d-466b-b362-42de7b6bbf66245','identity_mp_unionid'=>'','identity_cookie_id'=>'','$identity_mobile'=>'123'];
$properties=[];
$common=[];
$event='';

$sensors = new Sensors($action, $identityList, $properties, $common, $event);
$sensors->executeAction();

buqiu/sensors 适用场景与选型建议

buqiu/sensors 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 473 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 buqiu/sensors 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 buqiu/sensors 我们能提供哪些服务?
定制开发 / 二次开发

基于 buqiu/sensors 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 473
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-09-14