承接 heyday/silverstripe-analytics 相关项目开发

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

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

heyday/silverstripe-analytics

最新稳定版本:4.0.0

Composer 安装命令:

composer require heyday/silverstripe-analytics

包简介

Heyday's standard analytics module

README 文档

README

CI

Heyday's standard analytics module to be used across all sites requiring analytics

Installation

composer require heyday/silverstripe-analytics

Setup

First, add details to SilverStripe configuration; for instance by creating an analytics.yml file with the following details:

Page:
  extensions:
    - Heyday\Analytics\AnalyticsExtension
SilverStripe\Core\Injector\Injector:
  AnalyticsService:
    class: Heyday\Analytics\GoogleTagManagerProvider
    constructor:
      0: 'GTM-XXXXX'

For Google Tag Manager AnalyticsID will be something like:

GTM-XXXXX

For Google Analytics AnalyticsID will be something like:

UA-XXXXXXXXX-X

Analytics for the site can now be included in a SilverStripe template simply with the following code in the relevant .ss file:

{$AnalyticsCode.RAW}

Google Tag Manager Code

Google Tag Manager code should be set as high in the <head> of the page as possible:

<head>
	<title>Page Title</title>
	{$AnalyticsCode.RAW}

However, if you do have meta tags that set the charset or http-equiv attributes, you'll want them to be at the very top of head, since browsers expect them to be among the first characters of an HTML document.

Google Tag Manager no script tag is now separate from the Tag Manager container. To use it in your template, just call the variable TagManagerNoScript

</head>
<body>
	{$TagManagerNoScript}
...

Google Analytics Code

Google Analytics Code code should be set just after the <body> tag:

</head>
<body>
	{$AnalyticsCode}
...

Using Google Search Console verification with Google Tag Manager

If you have a Google Tag Manager account, you can verify ownership of a site using your Google Tag Manager container snippet code.

To verify ownership using Google Tag Manager, choose Google Tag Manager in the verification details page for your site, and follow the instructions shown.

When copying Tag Manager code:

  • You must have "View, Edit, and Manage" account level permissions in Google Tag Manager.
  • Place the Tag Manager code immediately after the opening tag of your page. If you do not, verification will fail.
  • You cannot insert a data layer (or anything other than HTML comments) between the tag and the tag manager code. If you do, verification will fail.
  • Use the code exactly as provided; do no modify it. If you modify it, verification will fail.

For more information, check out this page: https://support.google.com/webmasters/answer/35179

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-09-10