PHP code example of tumobi / weapp-analysis

1. Go to this page and download the library: Download tumobi/weapp-analysis library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tumobi / weapp-analysis example snippets



Tumobi\WeappAnalysis\WeappAnalysis;

$analysis = new WeappAnalysis('你的 appid', '你的 secret');

$result = $analysis->getdDailySummaryTrend('20180411', '20180411');
print_r($result);

// 概况趋势(天)
$dailySummaryTrend = $analysis->getdDailySummaryTrend($begin_date, $end_date);

// 访问趋势(日趋势)
$dailyVisitTrend = $analysis->getDailyVisitTrend($begin_date, $end_date);

// 访问趋势(周趋势)
$weeklyVisitTrend = $analysis->getWeeklyVisitTrend($begin_date, $end_date);

// 访问趋势(月趋势)
$monthlyVisitTrend = $analysis->getMonthlyVisitTrend($begin_date, $end_date);

// 访问分布
$visitDistribution = $analysis->getVisitDistribution($begin_date, $end_date);

// 访问留存(日留存)
$dailyRetainInfo = $analysis->getDailyRetainInfo($begin_date, $end_date);

// 访问留存(周留存)
$weeklyRetainInfo = $analysis->getWeeklyRetainInfo($begin_date, $end_date);

// 访问留存(月留存)
$monthlyRetainInfo = $analysis->getMonthlyRetainInfo($begin_date, $end_date);

// 访问页面 
$visitPage = $analysis->getVisitPage($begin_date, $end_date);

// 用户画像 
$userPortrait = $analysis->getUserPortrait($begin_date, $end_date);