Skip to content

Commit 1c6f5e4

Browse files
fix: ensure ad fallback content is visible when ads are blocked (#401)
Co-authored-by: Harlan Wilton <[email protected]>
1 parent 0919074 commit 1c6f5e4

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

playground/pages/third-parties/google-adsense/nuxt-scripts.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,17 @@ watch(() => route.query.format, (newFormat) => {
6767
>
6868
<template #awaitingLoad>
6969
<div class="text-white text-xl">
70-
...waiting
70+
...waiting to Ads
7171
</div>
7272
</template>
7373
<template #loading>
7474
<div class="text-white text-xl">
75-
...loading
75+
...Loading Ads
76+
</div>
77+
</template>
78+
<template #error>
79+
<div class="text-white text-xl">
80+
...Ad-Blocker detected
7681
</div>
7782
</template>
7883
</ScriptGoogleAdsense>

src/runtime/components/ScriptGoogleAdsense.vue

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,20 @@ const rootAttrs = computed(() => {
7474
</script>
7575

7676
<template>
77-
<ins
78-
ref="rootEl"
79-
class="adsbygoogle"
80-
style="display: block;"
81-
:data-ad-client="addClient"
82-
:data-ad-slot="dataAdSlot"
83-
:data-ad-format="dataAdFormat"
84-
:data-ad-layout="dataAdLayout"
85-
:data-full-width-responsive="dataFullWidthResponsive"
86-
v-bind="rootAttrs"
87-
>
77+
<div>
78+
<ins
79+
ref="rootEl"
80+
class="adsbygoogle"
81+
style="display: block;"
82+
:data-ad-client="addClient"
83+
:data-ad-slot="dataAdSlot"
84+
:data-ad-format="dataAdFormat"
85+
:data-ad-layout="dataAdLayout"
86+
:data-full-width-responsive="dataFullWidthResponsive"
87+
v-bind="rootAttrs"
88+
/>
8889
<slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
8990
<slot v-else-if="status === 'loading'" name="loading" />
9091
<slot v-else-if="status === 'error'" name="error" />
91-
</ins>
92+
</div>
9293
</template>

0 commit comments

Comments
 (0)