承接 reactmore-tech/google-analytics 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

reactmore-tech/google-analytics

最新稳定版本:1.0.0

Composer 安装命令:

composer require reactmore-tech/google-analytics

包简介

Google Analytics library for Codeigniter 4

README 文档

README

Installation

composer require reactmore-tech/google-analytics 

Configuration .env :

VIEW_ID=215165900
SERVICE_CREDENTIALS_JSON= 'google_analytic_services.json'

Usage :

service('GoogleAnalytics');
$GA = service('GoogleAnalytics');

$Analytics = new Analytics();

echo '<pre>';
$GA->Fetching()->fetchTopBrowsers(PeriodTime::days(10)) //Result Array
echo '</pre>';

// Method 
$Analytics = new Analytics();
// Fetch Users and New Users
$GA->Fetching()->fetchUserTypes(Period::days(7));
// Get Data Top Browser used visitor
$GA->Fetching()->fetchTopBrowsers(Period::days(7));
// Get Data Refferer Page
$GA->Fetching()->fetchTopReferrers(Period::days(7));
// Populer Pages
$GA->Fetching()->fetchMostVisitedPages(Period::days(7));
// Get Visitor and Pageviews
$GA->Fetching()->fetchTotalVisitorsAndPageViews(Period::days(7));

Example Output Array :

array(2) {
  [0]=>
  array(2) {
    ["type"]=>
    string(11) "New Visitor"
    ["sessions"]=>
    int(2581)
  }
  [1]=>
  array(2) {
    ["type"]=>
    string(17) "Returning Visitor"
    ["sessions"]=>
    int(1215)
  }
}
// Custom Query
$Analytics->Fetching()->performQuery($period, $metrix, $other = array());
// Example
$Analytics->Fetching()->performQuery(Period::days(7), 'ga:sessions', ['dimensions' => 'ga:country', 'sort' => '-ga:sessions'])->getRows();

Example Output Raw Array :

array(30) {
  [0]=>
  array(2) {
    [0]=>
    string(9) "Indonesia"
    [1]=>
    string(4) "3534"
  }
  [1]=>
  array(2) {
    [0]=>
    string(11) "Afghanistan"
    [1]=>
    string(2) "96"
  }
  [2]=>
  array(2) {
    [0]=>
    string(13) "United States"
    [1]=>
    string(2) "88"
  } 
}

Explore Query on this App ga-dev-tools

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固