[ads] experiment

This commit is contained in:
Andrea Vos 2023-02-15 19:26:48 +01:00
parent c62eee0d8a
commit 652d99953a
5 changed files with 22 additions and 14 deletions

View File

@ -1,12 +1,16 @@
\<template> \<template>
<div v-if="config.ads && config.ads.enabled && active" <div v-if="config.ads && config.ads.enabled && active"
:class="[adPlaceholdersVisible ? 'ad-placeholder' : '']"> :class="[adPlaceholdersVisible ? 'ad-placeholder' : '']">
<span v-if="adPlaceholdersVisible">{{phkey}} / {{adConfig.slotId}}</span> <template v-if="adPlaceholdersVisible">
<p class="text-center h5">{{phkey}}</p>
<Debug :v="adConfig"/>
</template>
<ins v-else class="adsbygoogle" <ins v-else class="adsbygoogle"
style="display:block" style="display:block"
data-ad-client="ca-pub-8518361481036191" data-ad-client="ca-pub-8518361481036191"
:data-ad-slot="adConfig.slotId" :data-ad-slot="adConfig.slotId"
:data-ad-format="adConfig.adFormat" :data-ad-format="adConfig.adFormat"
:data-ad-layout="adConfig.adLayout"
:data-full-width-responsive="adConfig.responsive ? 'true' : ''"></ins> :data-full-width-responsive="adConfig.responsive ? 'true' : ''"></ins>
</div> </div>
</template> </template>
@ -24,12 +28,13 @@ export default {
return { active: false, adConfig: {} }; return { active: false, adConfig: {} };
} }
const [slotId, adFormat, responsive] = adPlaceholders[this.phkey]; const {slotId, adFormat, adLayout = null, responsive = false} = adPlaceholders[this.phkey];
return { return {
active: true, active: true,
adConfig: { adConfig: {
slotId, slotId,
adFormat, adFormat,
adLayout,
responsive, responsive,
} }
} }
@ -50,8 +55,7 @@ export default {
.ad-placeholder { .ad-placeholder {
background-color: #b2caec; background-color: #b2caec;
width: 100%; width: 100%;
height: 80px; height: 200px;
padding: 1em; padding: 1em;
text-align: center;
} }
</style> </style>

View File

@ -1,6 +1,7 @@
<template> <template>
<Page> <Page>
<UkraineBanner class="mb-4"/> <UkraineBanner class="mb-4"/>
<AdPlaceholder phkey="small-homepage"/>
<template v-if="$te('home.welcome')"> <template v-if="$te('home.welcome')">
<section> <section>
<h2> <h2>

View File

@ -11,6 +11,8 @@
</div> </div>
</section> </section>
<AdPlaceholder phkey="small-homepage"/>
<div class="position-relative"> <div class="position-relative">
<div v-if="profile.sensitive.length && !contentWarningDismissed" class="content-warning text-center"> <div v-if="profile.sensitive.length && !contentWarningDismissed" class="content-warning text-center">
<ContentWarning :warnings="profile.sensitive" <ContentWarning :warnings="profile.sensitive"

View File

@ -2,6 +2,7 @@
<Page> <Page>
<MustLogin v-if="!$user()"/> <MustLogin v-if="!$user()"/>
<div v-else> <div v-else>
<AdPlaceholder phkey="small-homepage"/>
<div class="mb-3 d-flex justify-content-between flex-column flex-md-row"> <div class="mb-3 d-flex justify-content-between flex-column flex-md-row">
<h2 class="text-nowrap"> <h2 class="text-nowrap">
<Avatar :user="$user()"/> <Avatar :user="$user()"/>

View File

@ -1,23 +1,23 @@
export default { export default {
'support': [2557549454, 'auto', true], 'support': {slotId: 2557549454, adFormat: 'auto', responsive: true},
'aside-left-top': null, 'aside-left-top': null,
'aside-left-middle': [4999879969, 'auto', true], 'aside-left-middle': {slotId: 4999879969, adFormat: 'auto', responsive: true},
'aside-left-bottom': null, 'aside-left-bottom': null,
'aside-right-top': null, 'aside-right-top': null,
'aside-right-middle': [2369847195, 'auto', true], 'aside-right-middle': {slotId: 8917042232, adFormat: 'autorelaxed'}, // prev: {slotId: 2369847195, adFormat: 'auto', responsive: true},
'aside-right-bottom': [6664353412, 'auto', true], 'aside-right-bottom': {slotId: 6664353412, adFormat: 'auto', responsive: true},
'main-0': [8172838213, 'auto', true], 'main-0': {slotId: 3137058361, adFormat: 'auto', adLayout: 'in-article'}, // prev: {slotId: 8172838213, adFormat: 'auto', responsive: true},
'main-1': [3299823474, 'auto', true], 'main-1': {slotId: 3299823474, adFormat: 'auto', responsive: true},
'main-2': [3108251782, 'auto', true], 'main-2': {slotId: 3108251782, adFormat: 'auto', responsive: true},
'main-3': [6716873048, 'auto', true], 'main-3': {slotId: 6716873048, adFormat: 'auto', responsive: true},
'main-4': null, 'main-4': null,
'main-5': null, 'main-5': null,
'main-6': null, 'main-6': null,
'footer': [6584462360, 'autorelaxed', false], 'footer': {slotId: 6584462360, adFormat: 'autorelaxed'},
'small-homepage': [6146027401, 'auto', true], 'small-homepage': {slotId: 6146027401, adFormat: 'auto', responsive: true},
}; };