marshmallow / marketing-data-tracker
Parse and store marketing parameters like gclid, utm_*, and adid, and automatically attach them to user conversions or models in Laravel.
Fund package maintenance!
Marshmallow
Requires
- php: ^8.0
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
README
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
Installation
You can install the package via composer:
composer require marshmallow/marketing-data-tracker
You can publish and run the migrations with:
php artisan vendor:publish --tag="marketing-data-tracker-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="marketing-data-tracker-config"
After add the HasMarketingParameters trait to your model. And add the midleware \Marshmallow\MarketingData\Middleware\ParseMarketingParameters::class,
to your web
middleware group within your app/Http/Kernel.php
file.
For a Nova resource add the MarketingDataFields trait to your resource and add the functino to your fields array:
use Marshmallow\MarketingData\Fields\MarketingDataFields; $this->getMarketingDataFields( with_utm_data: true, with_google_ids: true, with_all_data: false, with_raw_data: true ),
Google Ads
On campaign level set the 'custom parameter' to 'campaign' and the value to the campaign Name without spaces.
After, add the following to the addon url on the account level;
'utm_source=google&utm_medium=cpc&utm_term={keyword}&utm_content={creative}&mm_campaignid={campaignid}&mm_adgroupid={adgroupid}&mm_feedid={feeditemid}&mm_position={adposition}&mm_linterest={loc_interest_ms}&mm_lphys={loc_physical_ms}&mm_matchtype={matchtype}&mm_network={network}&mm_device={device}&mm_devicemodel={devicemodel}&mm_creative={creative}&mm_keyword={keyword}&mm_placement={placement}&mm_targetid={target}&mm_version=G2&gclid={gclid}&utm_campaign={\_campaign}';
Usage
Add the trait and add the function to your model to save the marketing parameters:
use Marshmallow\MarketingData\Traits\HasMarketingParameters; $model->setUtmSourceData(forget: false);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.