fourlabs/gamp-bundle
Composer 安装命令:
composer require fourlabs/gamp-bundle
包简介
Google Analytics Measurement Protocol bundle for Symfony
关键字:
README 文档
README
Google Analytics Measurement Protocol Package for Symfony. Supports all GA Measurement Protocol API methods.
Installation
Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest version of this bundle:
$ composer require fourlabs/gamp-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Compatibility with Guzzle 5 and 6
If you are using PHP 5.5 or above and Guzzle 6 then:
{
"require": {
"fourlabs/gamp-bundle": "^2.0"
}
}
Or if you are using PHP 5.4 or above and Guzzle 5 then:
{
"require": {
"fourlabs/gamp-bundle": "^1.1"
}
}
Enable the Bundle
Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new FourLabs\GampBundle\FourLabsGampBundle(), ); }
Usage
This bundle exposes the service gamp.analytics. It is a non shared service, i.e. each time you retrieve the service you'll get a new instance.
Example
$this->get('gamp.analytics') ->setTransactionId('7778922') ->setAffiliation('THE ICONIC') ->setRevenue(250.0) ->setTax(25.0) ->setShipping(15.0) ->setCouponCode('MY_COUPON') ->setProductActionToPurchase() ->setEventCategory('Checkout') ->setEventAction('Purchase') ->sendEvent() ;
Refer to the library's documentation for other remaining methods and examples, they all work. This library 100% supports all GAMP features.
Note: You don't have to use the protocol version, tracking id, anonymize ip and async request (non-blocking) methods as they're automatically set in based on your config file.
Configuration
Example of configuration in app/config.yml:
four_labs_gamp:
protocol_version: 1
tracking_id: UA-XXXXXXX-X
use_ssl: true
anonymize_ip: false
async_requests: true
sandbox: true
Set your Google Analytics Tracking / Web Property ID in tracking_id key [REQUIRED]
See: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tid
tracking_id: UA-XXXX-Y
All other configuration options are optional, use as per your requirements.
The Protocol version. The current value is '1'. Default: 1
See: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#v
protocol_version: 1
To send data over SSL, set use_ssl to true. Default: true
See: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tid
use_ssl: true
To Anonymize IP, set anonymize_ip to true. Default: false
See: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#aip
anonymize_ip: true
To Make Async Requests, set async_requests to true. Default: true
async_requests: true
When sandbox mode is enabled, no hits are actually sent to GA. In this case the library returns a AnalyticsResponseInterface object that with empty values. Default: false
sandbox: true
Credits
This package is a wrapper around the GA Measurement Protocol PHP Library. Thanks to the guys @ THE ICONIC who developed the library!
License
fourlabs/gamp-bundle 适用场景与选型建议
fourlabs/gamp-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 432.37k 次下载、GitHub Stars 达 31, 最近一次更新时间为 2015 年 08 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「google」 「tracking」 「gamp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fourlabs/gamp-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fourlabs/gamp-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fourlabs/gamp-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP SDK for the Parcel Monkey UK API
Analytics chooser extensions for site settings.
A Laravel Nova Card to show Fathom Analytics stats.
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Audit changes of your Eloquent models in Laravel/Lumen
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
统计信息
- 总下载量: 432.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-25