Files
SkinbaseNova/resources/views/components/ad-unit.blade.php

29 lines
935 B
PHP

{{--
<x-ad-unit slot="1234567890" />
<x-ad-unit slot="1234567890" format="rectangle" class="my-6" />
Props:
slot AdSense ad slot ID (required)
format AdSense data-ad-format (default: auto)
class additional wrapper classes
Renders nothing when:
- GOOGLE_ADSENSE_PUBLISHER_ID is not set in .env
- User has not given consent (handled client-side via CSS class .ads-disabled)
--}}
@php
$publisherId = config('services.google_adsense.publisher_id');
@endphp
@if($publisherId)
<div class="ad-unit-wrapper {{ $attributes->get('class', '') }}">
<ins class="adsbygoogle"
style="display:block"
data-ad-client="{{ $publisherId }}"
data-ad-slot="{{ $slot }}"
data-ad-format="{{ $format ?? 'auto' }}"
data-full-width-responsive="true"></ins>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
</div>
@endif