Giter Site home page Giter Site logo

sensors's Introduction

sensors

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();

sensors's People

Contributors

smallk1002 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.