From 091cc1827a740ce581a47e80c780f68246197a7f Mon Sep 17 00:00:00 2001 From: Bryant Gillespie Date: Wed, 28 Aug 2024 13:21:16 -0400 Subject: [PATCH] Few Quick Fixes for PostHog A/B Testing (#167) --- components/Block/Tier.vue | 8 ++++---- pages/[...permalink].vue | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/components/Block/Tier.vue b/components/Block/Tier.vue index 0cf1b88..dfdac8b 100644 --- a/components/Block/Tier.vue +++ b/components/Block/Tier.vue @@ -38,12 +38,12 @@ const { data: block } = useAsyncData(props.uuid, () => {{ block.badge }}
-

{{ block.name }}

+

{{ block.name }}

{{ block.subtext }}  -

- {{ block.price }} +

+ {{ block.price }}
- {{ block.term }}  + {{ block.term }}  diff --git a/pages/[...permalink].vue b/pages/[...permalink].vue index a6eaa1b..f46daeb 100644 --- a/pages/[...permalink].vue +++ b/pages/[...permalink].vue @@ -80,7 +80,14 @@ const sections = computed(() => { if (block.experiment && block.experiment_variant) { const featureFlag = getFeatureFlag(block.experiment.feature_flag); - addBlock = featureFlag.value === block.experiment_variant.key; + + if (!featureFlag.value) { + // PostHog is blocked or unavailable, show the control variant + addBlock = block.experiment_variant.key === 'control'; + } else { + // PostHog is available, use the returned value + addBlock = featureFlag.value === block.experiment_variant.key; + } } // If the block should not be added, skip to the next iteration