Laravel

Add attribu.tech to your Laravel project.

Add the script to your layout

Open your Blade layout file (usually resources/views/layouts/app.blade.php) and add the tracking script inside the <head> tag:

<!-- resources/views/layouts/app.blade.php -->
<head>
  ...
  <script
    defer
    data-website-id="YOUR_SITE_ID"
    data-domain="yourdomain.com"
    src="https://attribu.tech/js/script.js"
  ></script>
</head>
Replace YOUR_SITE_ID with your actual Website ID from your attribu.tech dashboard. Replace yourdomain.com with your site's root domain.

Every view that extends this layout will automatically include the tracking script.

Optional: Use environment variables

Keep your configuration in .env and a config file instead of hardcoding values:

# .env
ATTRIBU_SITE_ID=YOUR_SITE_ID
ATTRIBU_DOMAIN=yourdomain.com

Create a config file:

// config/attribu.php
<?php

return [
    'site_id' => env('ATTRIBU_SITE_ID'),
    'domain' => env('ATTRIBU_DOMAIN'),
];

Then reference the config in your Blade template:

<script
  defer
  data-website-id="{{ config('attribu.site_id') }}"
  data-domain="{{ config('attribu.domain') }}"
  src="https://attribu.tech/js/script.js"
></script>

Stripe revenue attribution

If you use Stripe Checkout in your Laravel app, pass the attribu.tech visitor ID as metadata so revenue gets attributed to the correct traffic source:

use Illuminate\Support\Facades\Cookie;

$checkout = \Stripe\Checkout\Session::create([
    'line_items' => [[ /* your line items */ ]],
    'mode' => 'payment',
    'success_url' => route('checkout.success'),
    'cancel_url' => route('checkout.cancel'),
    'metadata' => [
        'attribu_visitor_id' => Cookie::get('attribu_vid'),
        'attribu_session_id' => Cookie::get('attribu_sid'),
    ],
]);
The tracking pixel sets attribu_vid and attribu_sid cookies on your domain. Reading them server-side and passing them as Stripe metadata is all you need for revenue attribution.

For the full Stripe setup (webhooks, API key, etc.), see the Stripe integration guide.

Verify installation

  1. Visit your Laravel site in a browser.
  2. Open Developer Tools and check the Network tab for a request to /js/script.js.
  3. Check your attribu.tech dashboard - a pageview should appear within a few minutes.
The tracking script ignores localhost by default. Deploy to a public URL or enable localhost debugging in your dashboard to test locally.

What's next

Copied