Install on Laravel
1. Install the package
Section titled “1. Install the package”composer require terragamingmedia/laravel-adsThe service provider is discovered automatically. To publish the config file:
php artisan vendor:publish --tag=tgm-config2. Add your values to .env
Section titled “2. Add your values to .env”TGM_HOST=tgmads.example.comOnce your CNAME is verified, the host is all you need. Before that, use the shared host and your ids:
TGM_HOST=cdn.terramedia-sandbox.comTGM_PROPERTY=PROP-…TGM_PUBLISHER=PUB-…TGM_IN_ARTICLE_UNIT=TGM-…-INARTTGM_ARTICLE_SELECTOR=".post-content"TGM_ENABLED=false turns the tag off, for example on local environments.
3. Add the site tag to your layout
Section titled “3. Add the site tag to your layout”In the <head> of your main layout:
<x-tgm-site-tag />or @tgmSiteTag. With a Content Security Policy, the component adds the nonce from
Vite::cspNonce() (or spatie/laravel-csp) automatically. You can also pass nonce="…".
4. Place your ad units
Section titled “4. Place your ad units”In any Blade view:
<x-tgm-ad unit="TGM-ABC-HRS01" />or @tgmAd('TGM-ABC-HRS01'). The same unit can appear more than once per page. In-article ads are
automatic.
Inertia, Livewire, Turbo
Section titled “Inertia, Livewire, Turbo”- Inertia (React or Vue): keep
<x-tgm-site-tag />inapp.blade.phpand place units with the React or Vue package (<TgmAd unit="…" />). See React and Vue. - Livewire
wire:navigateand Turbo update the URL withpushState. The tag starts a new page view by itself. Wrap the floating unit in@persist('tgm-floating')so it survives navigation.
