sminnee/tagmanager
Composer 安装命令:
composer require sminnee/tagmanager
包简介
SilverStripe's server-side answer to Google/Adobe Tag Manager
README 文档
README
SilverStripe's server-side answer to Google/Adobe Tag Manager!
SilverStripe tag manager provides a framework for adding programmatically-generated snippets of HTML to pages on your site. Examples include tracking codes for analytics and other packages and meta-tags.
To get full benefit of tag manager you should find or create modules that provide such snippets. CMS administrators can use the Tag Manager admin section to enable and configure these snippets.
Benefits
- Developers of SilverStripe modules that add front-end snippets to each page can write less code
- Different snippets can be configured & actvitated by CMS administrators
- Don't need to coordinate a developer release to get snippets added or removed
- Unused snippets can be disabled by the administrator, reducing page weight
Features
- Add site-wide snippets
- Add section-specific or page-specific snippets (coming soon)
- Developers: Build custom snippets by implementing the SnippetProvider interface provided
- Control which snippet types are available
Out of the box the following snippets are available
- Raw HTML, added to the head or the end of the body
- Google Analytics
- Google Tag Manager
- Crazy Egg
Disabling Snippet Types
If you're a developer you may need to disable some of the snippet types you haven't tested or that your client explicitly doesn't want available in the CMS. You can do this via configuration:
SilverStripe\TagManager\Model\Snippet: disabled_types: - 'SilverStripe\TagManager\SnippetProvider\HtmlSnippetProvider' - 'SilverStripe\TagManager\SnippetProvider\CrazyEggSnippetProvider'
This will disable the HTML & Crazy Egg snippets.
Add-on modules
Tag Manager is only as useful as its extension modules, have a look at modules that list it as a dependency to get some inspiration!
Creating your own tag
To create a new type of tag, you will need to write a PHP class that implements the SilverStripe\TagManager\SnippetProvider interface. A simple example is GoogleAnalyticsSnippetProvider.
Your class will need the following methods for helping configure the admin UI:
getTitle(): Return the title of this snippet provider for admin UIsgetSummary(array $params): Return a short description of the configured snippet. Params will be an map of param name => param valuegetParamFields(): Return aFieldListfor configuring the snippet. Each field should return a scalar value, so no GridFields sorry!
And this method to actually generate the snippet:
getSnippets(array $params): Return an map of snippet "zone" to snippet content.
Each snippet should be placed in a "zone". Zones are predefined insertion points within the overall page. Allowed zones are "start-head", "end-head", "start-body", "end-body". Your snippet provider can return more than 1 of these.
sminnee/tagmanager 适用场景与选型建议
sminnee/tagmanager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.64k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 09 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sminnee/tagmanager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sminnee/tagmanager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 18
- 依赖项目数: 9
- 推荐数: 1
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-09-15