axllent/silverstripe-analytics-js
Composer 安装命令:
composer require axllent/silverstripe-analytics-js
包简介
Google Universal Analytics tracking code for Silverstripe
README 文档
README
Please note that the functionality provided by this module is now fairly redundant since the release of Google Analytics 4 (GA4), and is no longer in active development.
If you're looking for an alternative then take a look at springtimesoft/silverstripe-tracking-scripts.
An extension to add Google Universal Analytics gtag() tracking code (not to be confused with Google Tag Manager) to your Silverstripe templates.
It automatically includes optional unobtrusive event tracking for all outbound links & "asset downloads", as well as event tracking for 404 and error pages, email & telephone links.
Features
- Google Universal Analytics (gtag.js) code injected automatically into
<head>of page to prevent JavaScript conflicts due to loading order (if you are using customgtag()functions in your other code. - Automatic
pageviewtracking for all configured accounts, including tracking of 404 & 500 page errors (tracked as "Page Not Found" / "Page Error" events). - Unobtrusive outbound, download, email & tel: link tracking - monitors all page clicks, rather than on page load (ie: works with links including those generated by Ajax etc on the page after page load).
- Uses Google Analytics
hitCallbackfor tracking for outgoing links to register before load (ie: when no linktargetis set) to ensure tracker is successfully run before redirection. - Tracking codes are automatically changed to
G-XXXXXXXX-[1-9]ifSS_ENVIRONMENT_TYPEis not live, or if page URL matches ?flush= to prevent bad data capture.
Event tracking
Additional event tracking is automatically enabled by default for:
- File downloads (all non-image files in the assets folder) are tracked as "Downloads".
- Outgoing links are tracked as "Outgoing Links".
- Email (
mailto:) links are tracked as "Email Links". - Phone (
tel:) links are tracked as "Phone Links".
Event category names (eg: "Outgoing Links", "Downloads" etc) can be configured in your yaml config.
Note: Event tracking only works with regular (left-or-middle) mouse button clicks (including combinations with Ctrl/Shift/Meta keys). Tracking is bypassed if the user right-clicks on a link and selects an action from the context menu (open in new tab, save as etc...). Unfortunately there is no way around this without disabling the content menu entirely.
Requirements
- Silverstripe ^6
For Silverstripe 4 & 5, please refer to the Silverstripe5 branch.
For the deprecated analytics.js tracking method for Silverstripe 4, please refer to the analytics.js branch.
For Silverstripe 3, please refer to the Silverstripe3 branch.
Installation via Composer
You can install it via composer with
composer require axllent/silverstripe-analytics-js
Basic usage
Once installed the extension is automatically loaded if you provide at least one tracking account in your config yaml file (eg) app/_config/analytics.yml
Axllent\AnalyticsJS\AnalyticsJS: tracker: - ['config', 'G-XXXXXXXX']
The syntax is very similar to the official documentation, so things like secondary trackers or other configurations can be easily added.
Axllent\AnalyticsJS\AnalyticsJS: tracker: - ['config', 'G-XXXXXXXX'] # default account [required] - ['config', 'G-XXXXXXXX-1'] # add secondary tracker - ['set', 'forceSSL', true] # force tracking to use SSL - ['require', 'ecommerce', 'ecommerce.js'] # load ecommerce extension track_links: false # disable external link & asset tracking ignore_link_class: "notrack" # if "track_links", then ignore external links with the "notrack" class compress_js: false # do not compress inline JavaScript primary_gtag_id: "G-XXXXXXXX" # set the default tracking id to be used when loading gtag (defaults to the first tracker)
Please refer to the Configuration.md for all configuration options.
To start live tracking, make sure your website is in live mode, or if running in dev or staging that you
have the track_in_dev_mode: true option.
axllent/silverstripe-analytics-js 适用场景与选型建议
axllent/silverstripe-analytics-js 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21.37k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2016 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「silverstripe」 「tracking」 「googleanalytics」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 axllent/silverstripe-analytics-js 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 axllent/silverstripe-analytics-js 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 axllent/silverstripe-analytics-js 相关的其它包
同方向 / 同关键字的高下载量 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.
CitaNZ's SilverStripe picture object and field for SilverStripe 4
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
统计信息
- 总下载量: 21.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-01