xruff/googleanalytics 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

xruff/googleanalytics

Composer 安装命令:

composer require xruff/googleanalytics

包简介

Nette extension - Google Analytics code

README 文档

README

Requirements

Package requires PHP 5.6 or higher

Installation

The best way to install XRuff/GoogleAnalytics is using Composer:

$ composer require xruff/googleanalytics

Documentation

Configuration in config.neon. Both parameters are optional.

If parameter code is missing, GA code will not be rendered in template. If parameter user is missing, default settings will be used - value on. If paramter user is on and user is logged in, google analytics code will contain directive ga('set', 'userId', {$user->id});

extensions:
    googleAnalytics: XRuff\App\UI\Components\DI\GoogleAnalyticsExtension

googleAnalytics:
    code: UA-123456789-1
    user: on # on/off - display user ID if user is logged in

Base presenter:

use XRuff\App\UI\Components\IGoogleAnalyticsControlFactory;

abstract class BasePresenter extends Nette\Application\UI\Presenter
{
	/** @var IGoogleAnalyticsControlFactory $googleAnalyticsControlFactory @inject */
	public $googleAnalyticsControlFactory;

	protected function createComponentGoogleAnalytics()
	{
		return $this->googleAnalyticsControlFactory->create();
	}
}

@layout.latte:

    ...
</head>
<body>
    {control googleAnalytics}
    ...

You can invoke parameters into control in latte template. 1st parameter is GA code. 2nd parameter should be boolean and manage displaying GA directive for user's session - ga('set', 'userId', {$user->id});. Both parameters are optioanl.

    ...
</head>
<body>
    {control googleAnalytics 'UA-123456789-2', false}
    ...

Repository https://github.com/XRuff/GoogleAnalytics.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-04-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固