Download the PHP package freshbitsweb/laravel-google-analytics-4-measurement-protocol without Composer

On this page you can find all versions of the php package freshbitsweb/laravel-google-analytics-4-measurement-protocol. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-google-analytics-4-measurement-protocol

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

Installation

1) Install the package by running this command in your terminal/cmd:

2) 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

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

4) 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.

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:

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


All versions of laravel-google-analytics-4-measurement-protocol with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
guzzlehttp/guzzle Version ^6.0|^7.0
illuminate/http Version ^7.0|^8.0|^9.0|^10.0
illuminate/view Version ^7.0|^8.0|^9.0|^10.0
spatie/laravel-package-tools Version ^1.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package freshbitsweb/laravel-google-analytics-4-measurement-protocol contains the following files

Loading the files please wait ....