Download the PHP package tijmenwierenga/snowplow-tracker without Composer

On this page you can find all versions of the php package tijmenwierenga/snowplow-tracker. 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 snowplow-tracker

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Snowplow Tracker

An alternative to the original Snowplow Tracker.

This Tracker provides:

Installation

With composer:

Setup

The Snowplow Tracker is instantiable by providing an emitter and optionally additional configuration. Currently, only a single emitter is available: the HttpClientEmitter.

HttpClientEmitter

The HttpClientEmitter sends the payload to a collector over HTTP. If you want to use this emitter a PSR-7, PSR-17 and PSR-18 compliant implementation needs to be installed.

Popular PSR-18 compliant HTTP Clients are:

Popular PSR-7 compliant libraries are:

By default, the php-http/discovery will discover the installed HTTP Client and Request Factory so no additional configuration is required. If you wish to configure your HTTP client yourself you can pass in your own. Same goes for the Request Factory.

With auto-discovery:

Without auto-discovery (with Symfony's HTTP client):

Tracker configuration

In order to customize the tracker's configuration you can pass an additional configuration object:

Handling failures

Whenever emitting an event fails, you don't want to lose the data. Therefore, a TijmenWierenga\SnowplowTracker\Emitters\FallbackStrategy exists in order to help you recover from failures.

The FallbackStrategy is called whenever the TijmenWierenga\SnowplowTracker\Emitters\FailedToEmit exception is raised. By default, a void fallback strategy is used, which means nothing happens when an event failed emitting. It's advised to implement an own implementation that stores the failed payloads in order to attempt to send the failed events at a later time.

Configure the fallback strategy as a constructor argument for the Tracker:

If a FailedToEmit exception is raised, the Tracker will rethrow the exception after calling the fallback strategy. This could potentially lead to client-facing errors which may be undesirable. This behaviour can be changed by setting the $throwOnError constructor argument for the Tracker:

Please note that without a sufficient fallback strategy, ignoring exceptions will lead to data loss without anyone noticing.

Usage

Tracking events is done by calling the track() method on the Tracker instance: This library implements 6 type of events.

Pageviews

Page pings

Ecommerce transactions

Transaction items

Structured events

Unstructured events

The Snowplow Tracker protocol

All events extend from a base event class which implements all properties currently available in the Snowplow Tracker Protocol. These properties are publicly available in every event. The example below shows how to add a userId to an event to identify a user:

Custom context

Sometimes you want to add additional context to an event. Custom contexts are self-describing JSON schema's which can be implemented by creating a class that implements TijmenWierenga\SnowplowTracker\Events\Schemable. The example below shows an implementation of the existing Timing JSON Schema as defined by Snowplow Analytics.

As an example, let's include context about the page load in a pageview event:

Middleware

Middlewares provides a way to act on events that are tracked. Every piece of middleware is a callable that receives the event as an argument and must return the (modified) event to the next piece of middleware:

This is incredibly useful when you want to add contextual information to every event. As an example, middleware is added that adds the userId of the currently authenticated user to the event.

In the example above both events will now have a userId attached.


All versions of snowplow-tracker with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ramsey/uuid Version ^4.2.3
ramsey/collection Version ^1.2.0
psr/http-client Version ^1.0
php-http/discovery Version ^1.14
php-http/httplug Version ^2.2
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 tijmenwierenga/snowplow-tracker contains the following files

Loading the files please wait ....