承接 setono/google-analytics-events 相关项目开发

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

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

setono/google-analytics-events

最新稳定版本:v1.0.0-rc

Composer 安装命令:

composer require setono/google-analytics-events

包简介

A library that eases the generation of Google Analytics events

README 文档

README

Latest Version Software License Build Status Code Coverage Mutation testing

Easily build Google Analytics 4 Events.

Installation

composer require setono/google-analytics-events

Usage

use Setono\GoogleAnalyticsEvents\Event\PurchaseEvent;
use Setono\GoogleAnalyticsEvents\Writer\GtagWriter;

$event = PurchaseEvent::create('TRANS_1234')
    ->setCurrency('USD')
    ->setValue(123.45)
    ->setTax(10.45)
    ->setShipping(3.32)
    ->addItem(Item::create()->setId('SKU1234')->setName('Blue t-shirt'))
;

$writer = new GtagWriter();
echo $writer->write($event); // output: gtag("event", "purchase", {"currency":"USD","transaction_id":"TRANS_1234","value":123.45,"shipping":3.32,"tax":10.45,"items":[{"item_id":"SKU1234","item_name":"Blue t-shirt","quantity":1}]});

References

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-29