heddiyoussouf/mailtracker

There is no license information available for the latest version (1.0.0) of this package.

This package provides a simple yet effective solution to track email opens using an embedded image in Laravel applications. By embedding a unique image uri in emails, the package allows developers to identify when the email has been opened and viewed by the recipient.

1.0.0 2023-09-06 23:09 UTC

This package is not auto-updated.

Last update: 2024-04-19 02:18:26 UTC


README

heddiyoussouf/mailtracker provides an efficient way to track email opens in Laravel applications. It integrates seamlessly, leveraging embedded images to monitor when recipients view their emails. Table of Contents

Features
Installation
Usage
Customizations
Conclusion

Features

Mail Model: Logs individual emails with details.
Mailtracker Model: Records email open actions with attributes such as ip and user_agent.
HasTracker Trait: Equips the Mail model with the ability to generate unique tracking URLs.

Installation

Install via Composer:

bash

composer require heddiyoussouf/mailtracker

If not using Laravel's package auto-discovery, register the service provider in config/app.php:

php

'providers' => [
    // ...
    Heddiyoussouf\Mailtracker\MailTrackerProvider::class,
]

Usage

Integrate the Mail and Mailtracker models as needed. Attach the HasTracker trait to your Mail model. Generate tracking URLs: For individual emails: $mail->singleView() For broadcast emails: $mail->multipleView() Embed the tracking image in the email's Blade view:

blade.php

@mailtracker($trackingURL)

Customizations

Publish Assets and Config:

bash

php artisan vendor:publish --provider="Heddiyoussouf\Mailtracker\MailTrackerProvider"

Styling the Image: The embedded image can be styled using its class mailtracker-image or its ID mailtracker-image.

css

.mailtracker-image {
    /* Your styles here */
}
/*or*/
#mailtracker-image {
    /* Your styles here */
}

Config Customizations: Adjust the mailtracker.php config to specify a custom image or make other configurations.

return [
    'image' => 'assets/footer.png',
];

Conclusion

Mailtracker simplifies email open tracking in Laravel. Through easy integration, detailed tracking, and flexible customization, it stands as a robust solution for all Laravel-based email campaigns.