PHPackages                             marketin-inc/marketin-laravel-bridge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. marketin-inc/marketin-laravel-bridge

ActiveLibrary

marketin-inc/marketin-laravel-bridge
====================================

Marketin SDK bridge package for Laravel applications.

v1.1.3(5mo ago)023MITPHPPHP ^8.2

Since Oct 21Pushed 5mo agoCompare

[ Source](https://github.com/MarketIN-Inc/marketin_laravel_bridge)[ Packagist](https://packagist.org/packages/marketin-inc/marketin-laravel-bridge)[ RSS](/packages/marketin-inc-marketin-laravel-bridge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (22)Used By (0)

Marketin Laravel Bridge
=======================

[](#marketin-laravel-bridge)

A lightweight, automation‑ready integration layer that brings Marketin tracking, attribution persistence, and Paystack conversion automation to any Laravel application. This package injects the Marketin JavaScript SDK, listens to Paystack verification responses, manages attribution data, and queues conversions that follow Marketin’s latest API schema.

This README (Option B) includes fully detailed sections, explanations, and integration steps for both beginners and advanced Laravel developers.

---

Table of Contents
-----------------

[](#table-of-contents)

1. Features
2. Requirements
3. Installation
4. Environment Setup
5. Blade Directives
6. Layout Integration (Full Example)
7. Paystack Flow &amp; Automatic Conversion Tracking
8. Attribution Persistence
9. Configuration Reference
10. Conversion Queueing &amp; Session Alignment
11. Troubleshooting
12. Support

---

1. Features
-----------

[](#1-features)

- **Zero‑config SDK injection** – `@marketinScripts()` loads the official Marketin SDK + bridge bundle.
- **Automatic Paystack tracking** – Detects verification responses from Laravel’s HTTP client and queues conversions.
- **Attribution persistence** – `pid`, `cid`, `aid` follow users through pages, checkout redirects, and webhooks.
- **Session alignment** – every conversion includes your Laravel `session_id`.
- **Event normalization** – ensures `event` and `event_type` match Marketin API requirements.
- **No boilerplate tracking code** – controllers remain clean; no manual posting required.
- **Powerful logging** – `MARKETIN_DEBUG=true` prints detailed logs for each tracking decision.

---

2. Requirements
---------------

[](#2-requirements)

- PHP 8.2+
- Laravel 10.x, 11.x, or 12.x
- Queue worker (`database`, `redis`, `sqs`, or `sync`)
- Paystack integration using Laravel’s HTTP client

---

3. Installation
---------------

[](#3-installation)

```
composer require marketin-inc/marketin-laravel-bridge
```

The package auto‑discovers its service provider.

---

4. Environment Setup
--------------------

[](#4-environment-setup)

Add the minimum configuration:

```
MARKETIN_BRAND_ID=your-brand-id
MARKETIN_API_ENDPOINT=https://api.marketin.now/api/v1
MARKETIN_PAYSTACK_ENABLED=true
MARKETIN_DEBUG=true   # optional, helpful during testing
```

Run a queue worker:

```
php artisan queue:work
```

---

5. Blade Directives
-------------------

[](#5-blade-directives)

### `@marketinScripts()`

[](#marketinscripts)

Loads:

- Marketin SDK
- Marketin bridge bundle
- configuration payload

**Placement:** inside ``.

---

### `@marketinAutoTrack()`

[](#marketinautotrack)

Forces automation for the current request. It **prints no HTML**.

Automation includes:

- Paystack metadata injection
- HTTP verification listener
- webhook-context recovery
- conversion auto‑queueing

**Placement:** Place immediately \*\*after \*\*`` in your base layout.

---

### `@marketinTracking()`

[](#marketintracking)

Pushes structured tracking events to your tracking layer.

**Placement:** bottom of ``.

---

6. Layout Integration (Full Example)
------------------------------------

[](#6-layout-integration-full-example)

```

    @marketinScripts()

    @marketinAutoTrack()

    {{ $slot ?? '' }}

    @marketinTracking([
        'event' => 'marketin.page_view',
        'productId' => request('pid'),
    ])

```

This ensures automation + SDK loading on every page.

---

7. Paystack Flow &amp; Automatic Conversion Tracking
----------------------------------------------------

[](#7-paystack-flow--automatic-conversion-tracking)

You **must keep your Paystack verification logic**. The bridge listens to the verification response and queues conversions.

Your usual code:

```
$response = Http::withToken(config('paystack.secret_key'))
    ->get("https://api.paystack.co/transaction/verify/{$reference}");

if ($response->successful() && $response->json('data.status') === 'success') {
    // Your order processing logic
}
```

**Do not manually track conversions.**
The package detects the verification response and queues the conversion.

---

8. Attribution Persistence
--------------------------

[](#8-attribution-persistence)

The package captures `pid`, `cid`, `aid` from URLs like:

```
?pid=10&cid=3&aid=8

```

Attribution is persisted via:

- Laravel session
- encrypted cookies
- checkout‑context caching (per Paystack reference)

Precedence:

1. URL parameters
2. session/cookie
3. cached Paystack reference context
4. fallback config values

---

9. Configuration Reference
--------------------------

[](#9-configuration-reference)

Common environment variables:

VariableDescription`MARKETIN_BRAND_ID`Required brand identifier`MARKETIN_API_ENDPOINT`Marketin API root`MARKETIN_PAYSTACK_ENABLED`Enables webhook route`MARKETIN_AUTO_TRACK_HTTP_VERIFICATION`Enables auto‑detection of Paystack responses`MARKETIN_DEFAULT_EVENT_TYPE`Default event type (e.g., purchase)`MARKETIN_DEBUG`Verbose logsYou rarely need to publish `config/marketin.php`.

---

10. Conversion Queueing &amp; Session Alignment
-----------------------------------------------

[](#10-conversion-queueing--session-alignment)

When Paystack verification succeeds:

- attribution IDs are resolved
- event + event\_type are normalized
- session\_id is attached
- a conversion job is queued: `SendConversionToMarketin`

The job posts conversions to the API and logs success or failures.

---

11. Troubleshooting
-------------------

[](#11-troubleshooting)

### Conversions not appearing

[](#conversions-not-appearing)

- Ensure `@marketinAutoTrack()` is in your layout.
- Run a queue worker.
- Check `laravel.log` for Marketin messages.

### Duplicate conversions

[](#duplicate-conversions)

- Ensure you are **not** manually calling a Marketin tracking function.

### Missing brand ID

[](#missing-brand-id)

Set:

```
MARKETIN_BRAND_ID=your-brand-id
```

### Paystack auto‑track skipped

[](#paystack-autotrack-skipped)

Enable:

```
MARKETIN_DEBUG=true
```

Check logs for precise skip reasons.

---

12. Support
-----------

[](#12-support)

- Open an issue in this repository.
- Contact your Marketin solutions engineer for integration or production assistance.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance69

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

21

Last Release

179d ago

Major Versions

v0.1.0 → v1.0.12025-11-12

v0.0.9 → v1.0.22025-11-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/e5afc6b8a98eaaebc57d3e8c1a727f096cedfc3edca7a0386ad6ddcf1a807772?d=identicon)[Market!N-Inc](/maintainers/Market!N-Inc)

---

Top Contributors

[![AYG3](https://avatars.githubusercontent.com/u/116680437?v=4)](https://github.com/AYG3 "AYG3 (29 commits)")

---

Tags

laravelsdktrackingmarketin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/marketin-inc-marketin-laravel-bridge/health.svg)

```
[![Health](https://phpackages.com/badges/marketin-inc-marketin-laravel-bridge/health.svg)](https://phpackages.com/packages/marketin-inc-marketin-laravel-bridge)
```

###  Alternatives

[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
