From b74ab21bc893bae81457c4905575ea7189d6740a Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sat, 23 Mar 2024 12:12:23 +0800 Subject: [PATCH] improve mobile ad --- src/components/ad/AdBanner.vue | 4 ++-- src/components/ad/ad.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/ad/AdBanner.vue b/src/components/ad/AdBanner.vue index cfca09d2..ff3b7ec9 100644 --- a/src/components/ad/AdBanner.vue +++ b/src/components/ad/AdBanner.vue @@ -25,7 +25,7 @@ onMounted(() => { diff --git a/src/components/ad/ad.ts b/src/components/ad/ad.ts index 6e69d18a..5d1ad35f 100644 --- a/src/components/ad/ad.ts +++ b/src/components/ad/ad.ts @@ -6,10 +6,10 @@ interface ADConfig { } export const confs: Record = { - // "localhost": { - // apiKey: 'XXXX_api_key_staging_XXXX', // An actual API key is generated once you register an app with us. - // environment: 'staging', // use value 'production' when going live - // }, + "localhost": { + apiKey: 'XXXX_api_key_staging_XXXX', // An actual API key is generated once you register an app with us. + environment: 'staging', // use value 'production' when going live + }, "ping.pub": { apiKey: 'persona-pub-0x6ca028de83d9bc438bb3fd7f9620f36b', environment: 'production', @@ -24,12 +24,15 @@ export const confs: Record = { export const UNITS: Record> = { "localhost": { "banner": "3a094192-4c7b-4761-a50c-bd9b6a67e987", + "banner_mobile": "e6b82a11-6a94-46c0-a9d2-cf730159a5e6", }, "ping.pub": { "banner": "6883877a-ccae-4a08-b457-7e30b3465a8c", + "banner_mobile": "a95c6b55-5e2a-49eb-8993-a488513b2d10", }, "testnet.ping.pub": { "banner": "1644951b-5022-4544-8a85-11aef8a8f645", + "banner_mobile": "81e0527f-475a-42a4-bb9a-ed9967c5d06f", }, } @@ -44,6 +47,6 @@ export function getClient() { export function getUnit(ad: string): string | undefined { const ads = UNITS[location.hostname] if(ads) { - return ads[ad] + return window.innerWidth > 600 ? ads[ad] : ads[`${ad}_mobile`] } }