Download the PHP package victord11/laravel-utm without Composer
On this page you can find all versions of the php package victord11/laravel-utm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download victord11/laravel-utm
More information about victord11/laravel-utm
Files in victord11/laravel-utm
Package laravel-utm
Short Description Keeps track of the UTM parameters
License MIT
Homepage https://github.com/victord11/laravel-utm
Informations about the package laravel-utm
This package is an updated fork of adzbuck/laravel-utm
Keeps track of UTMs and/or other parameters
This package allows you to easily track first and last touch query parameters and headers via session. You can then easily access these parameters so you can add them to a form submission or a link to another domain you track.
Installation
You can install the package via composer:
The package works via a middleware that needs to be added to the web
stack in your kernel.php
file. Make sure to register this middleware after the StartSession
middleware.
To configure the tracked parameters or how they're mapped on the URL parameters, you can publish the config file using:
This is the contents of the published config file:
Usage
There are three methods of tracking:
- getFirstTouch
- This will get the parameters from the users first visit.
- getLastTouch
- This will get the parameters from the users last visit.
- getCurrent
- This will get the parameters from the current request.
The easiest way to retrieve the tracked parameters is by resolving the ParameterTracker
class:
You can also decorate an existing URL with the tracked parameters. This is useful to forward analytics to another domain you're running analytics on.
The example uses three requests:
decorateUrl/@trackedUrl
This does not use the session tracking, it simply uses the params provided.
decorateUrlFromFirstTouch/@trackedUrlFromFirstTouch
This adds the parameters from the users first visit. You can also add extra params via an array as the second parameter.
decorateUrlFromLastTouch/@trackedUrlFromLastTouch
This adds the parameters from the users Last visit. You can also add extra params via an array as the second parameter.
decorateUrlFromCurrent/@trackedUrlFromCurrent
This adds the parameters from the users Last visit. You can also add extra params via an array as the second parameter.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.