sy/google-analytics
Composer 安装命令:
composer require sy/google-analytics
包简介
Google Analytics web component
README 文档
README
A web component for adding Google Analytics on your website
Installation
Install the latest version with
$ composer require sy/google-analytics
Basic Usage
<?php use Sy\Component\Html\Page; use Sy\Component\Web\GoogleAnalytics; require __DIR__ . '/../vendor/autoload.php'; $ga = new GoogleAnalytics('ID-XXXXX'); $page = new Page(); $page->addBody($ga); echo $page;
Output:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <script src="https://www.googletagmanager.com/gtag/js?id=ID-XXXXX" async></script> </head> <body> <script type="module"> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'ID-XXXXX');</script> </body> </html>
统计信息
- 总下载量: 415
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-09