oscarotero/matomo-tracker

A matomo-tracker url generator compatible with PSR-7

dev-master 2019-02-19 17:56 UTC

README

Build Status

Simple library to generate Matomo tracker urls that you can use to insert tracking images in your site. It's compatible with PSR-7 ServerRequestInterfaces

Requirements

  • PHP >= 7.0

Installation

This package is installable and autoloadable via Composer as oscarotero/matomo-tracker.

composer require oscarotero/matomo-tracker

Example

use MatomoTracker\Url;

$url = Url::createFromServerRequest($serverRequest, 'https://analytics.example.com/piwik.php', 1);

$url->title('Page title')
    ->userId($user->getId());

echo sprintf('<img src="%s">', (string) $url);

Please see CHANGELOG for more information about recent changes.

The MIT License (MIT). Please see LICENSE for more information.