承接 freshbitsweb/laravel-google-analytics-4-measurement-protocol 相关项目开发

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

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

freshbitsweb/laravel-google-analytics-4-measurement-protocol

Composer 安装命令:

composer require freshbitsweb/laravel-google-analytics-4-measurement-protocol

包简介

A Laravel package to use Measurement Protocol for Google Analytics 4

README 文档

README

Plant a Tree

Laravel Google Analytics 4 Measurement Protocol

A Laravel package to use Measurement Protocol for Google Analytics 4.

Introduction

This package allows you to post events to Google Analytics 4 from your Laravel backend.

Supported Laravel versions

  • Laravel 7.x
  • Laravel 8.x
  • Laravel 9.x
  • Laravel 10.x
  • Laravel 11.x
  • Laravel 12.x
  • Laravel 13.x

Installation

  1. Install the package by running this command in your terminal/cmd:
composer require freshbitsweb/laravel-google-analytics-4-measurement-protocol
  1. Set MEASUREMENT_ID and MEASUREMENT_PROTOCOL_API_SECRET in your .env file. You can get them from: Google Analytics > Admin > Data Streams > [Select Site] > Measurement Protocol API secrets

  2. Optional: You can publish the config file by running this command in your terminal/cmd:

php artisan vendor:publish --tag=google-analytics-4-measurement-protocol-config
  1. client_id is required to post an event to Google Analytics. This package provides a Blade component which you can put in your layout file after the Google Analytics Code tracking code. It makes a POST request to the backend to store the client id in the session which is later used to post events to Google Analytics 4.
<!-- Google Analytics Code -->
<x-google-analytics-client-id />
<!-- </head> -->

The other option is to call the setClientId($clientId) method on the GA4 facade everytime before calling the postEvent() method.

Usage

You can simple call GA4::postEvent($eventData) from anywhere in your backend to post event to Google Analytics 4. $eventData contains the name and params of the event as per this reference page. For example:

GA4::postEvent([
    'name' => 'login',
    'params' => [
        'method' => 'Google',
    ],
]);

postEvent() method will return an array with the status of the request.

Debugging Mode

You can also enable debugging mode by calling enableDebugging() method before calling the postEvent() method. Like so - GA4::enableDebugging()->postEvent($eventData). The postEvent() method will return the response (array) from Google Analytics request in that case.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Treeware

You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to our forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at for our forest here offset.earth/treeware

Read more about Treeware at treeware.earth

Special Thanks to

freshbitsweb/laravel-google-analytics-4-measurement-protocol 适用场景与选型建议

freshbitsweb/laravel-google-analytics-4-measurement-protocol 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 124.4k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2021 年 03 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「freshbitsweb」 「laravel-google-analytics-4-measurement-protocol」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 freshbitsweb/laravel-google-analytics-4-measurement-protocol 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 freshbitsweb/laravel-google-analytics-4-measurement-protocol 我们能提供哪些服务?
定制开发 / 二次开发

基于 freshbitsweb/laravel-google-analytics-4-measurement-protocol 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

与 freshbitsweb/laravel-google-analytics-4-measurement-protocol 相关的其它包

同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:

统计信息

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

GitHub 信息

  • Stars: 20
  • Watchers: 3
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-18