combindma/sendinblue-tracker

This package is abandoned and no longer maintained. No replacement package was suggested.

Sendinblue Tracker SDK For PHP

1.0.3 2021-10-11 12:27 UTC

This package is auto-updated.

Last update: 2023-04-11 16:12:20 UTC


README

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

Installation

You can install the package via composer:

composer require combindma/sendinblue-tracker

You can publish the config file with:

php artisan vendor:publish --provider="Combindma\SendinBlueTracker\SendinBlueTrackerServiceProvider" --tag="sendinblue-tracker-config"

This is the contents of the published config file:

return [
    'tracker_id' => env('SENDINBLUE_TRACKER_ID', null),

    /*
     * The key under which data is saved to the session with flash.
     */
    'sessionKey' => env('SENDINBLUE_TRACKER_SESSION_KEY', strtolower(config('app.name')).'_sendinbluetracker'),

    /*
     * Enable or disable script rendering. Useful for local development.
     */
    'enabled' => env('ENABLE_SENDINBLUE_TRACKER', false),
];

Usage (JS implementation)

This is the js implementation. There is also RESTFUL implementation

Embed in Blade (Only if you want to use JS implementation)

First you'll need to include Sendinblue Tracker's script.

<!DOCTYPE html>
<html>
<head>
    @include('sendinbluetracker::head')
</head>
<body>
    @include('sendinbluetracker::body')
    /*
    * Content
    */
</body>

Identify

The is the primary way to create a new user within sendinblue or update an exsisting one. The primary way of indentifying users is via their email address.

SendinBlueTracker::identify('email@email.com');

Event

The next method is how we fire an event within sendinblue, this can be used to trigger workflows and other types of automation.

SendinBlueTracker::event(
    'eventName',
    // Event Data
    [
      'CTA_URL' => 'https://www.example.com',
      'COST' => '20.00'
    ],
    // User Data
    [
      'EMAIL' => 'email@email.com',
      'FIRSTNAME' => 'XXXXX'
    ]
);

Flashing data for the next request

The package can also set data to render on the next request. This is useful for setting data after an internal redirect.

SendinBlueTracker::flash(
    'event name',
  	// Event Data (optional)
    [
      'CTA_URL' => 'https://www.example.com',
      'COST' => '20.00'
    ],
    // User Data (optional)
    [
      'EMAIL' => 'email@email.com',
      'FIRSTNAME' => 'XXXXX'
    ]
);

Usage (RESTFUL implementation)

For this implementation you don't need to include Sendinblue Tracker's script

Identify

SendinBlueTracker::identifyPost('email@email.com',[
    'FIRSTNAME' => 'first name',
    'LASTNAME' => 'last name'
]);

Event

SendinBlueTracker::eventPost('email@email.com', 'event name',
  	// Event Data (optional)
    [
      'CTA_URL' => 'https://www.example.com',
      'COST' => '20.00'
    ],
    // User Data (optional)
    [
      'EMAIL' => 'email@email.com',
      'FIRSTNAME' => 'XXXXX'
    ],
);

Contributing

Please see CONTRIBUTING for details.

Credits

License

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