Download the PHP package freema/ga4-measurement-protocol-bundle without Composer

On this page you can find all versions of the php package freema/ga4-measurement-protocol-bundle. 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 ga4-measurement-protocol-bundle

Google Analytics 4 Measurement Protocol Bundle

CI Coverage License: MIT PHP Symfony code style: prettier

This bundle provides a clean, object-oriented integration with Google Analytics 4 Measurement Protocol for Symfony applications. It uses an event-based approach to track page views, purchases, and custom events in GA4.

Requirements

Installation

Configuration

Add the bundle to your config/bundles.php:

Create a configuration file config/packages/ga4_measurement_protocol.yaml:

Full Configuration Reference

Using the Bundle

The bundle uses an event-based approach where you create specific event objects, add them to the client, and then send them. This makes the code cleaner and easier to understand.

Basic Usage

Page View Example

Purchase Event Example

Event Types

The bundle provides a variety of pre-defined event types that match GA4's standard events.

E-commerce Events

Engagement Events

Custom Event

Creating Your Own Event Classes

You can easily create your own event classes for specific events:

ID Management

Client ID

Client ID is required by GA4 to identify unique users. The bundle will:

  1. Try to get it from the _ga cookie
  2. Use a fixed value if configured:

  3. Accept a programmatic value:

  4. Use a custom handler:

User ID

User ID helps identify logged-in users across devices. You can:

  1. Set it programmatically:

  2. Use a custom handler:

Session ID

Session ID helps GA4 group events that happen in the same session. The bundle can:

  1. Extract it from the GA4 cookie for your property:

  2. Accept a programmatic value:

  3. Use a custom handler:

Debug Mode

Debug mode enables detailed validation of your events from GA4:

  1. Configure it globally:

  2. Set it programmatically:

When debug mode is enabled:

License

This bundle is available under the MIT License. See the LICENSE file for more information.


All versions of ga4-measurement-protocol-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/http-kernel Version ^5.4|^6.4|^7.1
symfony/framework-bundle Version ^5.4|^6.4|^7.1
symfony/dependency-injection Version ^5.4|^6.4|^7.1
symfony/config Version ^5.4|^6.4|^7.1
symfony/http-client Version ^5.4|^6.4|^7.1
symfony/yaml Version ^5.4|^6.4|^7.1
psr/http-client Version ^1.0
php-http/discovery Version ^1.14
symfony/http-client-contracts Version ^2.5|^3.0
nyholm/psr7 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 freema/ga4-measurement-protocol-bundle contains the following files

Loading the files please wait ....