Skip to content

Commit

Permalink
📈 Set utm_medium for internal button
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Nov 5, 2024
1 parent 33789a0 commit a86bb3f
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@
<div class="grid grid-flow-row gap-y-[16px]">
<NuxtLink
class="hover:underline"
:to="localeLocation({ name: 'store' })"
:to="
localeLocation({
name: 'store',
query: {
ll_medium: 'footer',
},
})
"
@click.native="handleClickButton('store_books')"
>
{{ $t('footer_nav_store_books') }}
Expand Down
4 changes: 4 additions & 0 deletions src/components/NFTBook/ItemCardV2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export default {
type: Boolean,
default: true,
},
internalMedium: {
type: String,
default: '',
},
},
data() {
return {
Expand Down
7 changes: 6 additions & 1 deletion src/components/SiteHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
</NuxtLink>

<ButtonV2
:to="localeLocation({ name: 'store' })"
:to="
localeLocation({
name: 'store',
ll_medium: 'header_store_button',
})
"
preset="tertiary"
size="mini"
:text="$t('header_button_try_collect')"
Expand Down
6 changes: 6 additions & 0 deletions src/mixins/nft-or-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,18 @@ export default {
params: {
collectionId: this.collectionId,
},
query: {
ll_medium: this.internalMedium,
},
})
: this.localeLocation({
name: 'nft-class-classId',
params: {
classId: this.classId,
},
query: {
ll_medium: this.internalMedium,
},
});
},
},
Expand Down
7 changes: 6 additions & 1 deletion src/mixins/utm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ export default {
return {
utmCampaign: this.$route.query.utm_campaign,
utmSource: this.$route.query.utm_source,
utmMedium: this.$route.query.utm_medium,
utmMedium: this.$route.query.utm_medium || this.internalMedium,
documentReferrer: '',
fbClickId: this.formattedFbcQs,
};
},
computed: {
internalMedium() {
return this.$route.query.ll_medium;
},
gadClickId() {
return this.$route.query.gclid;
},
Expand All @@ -33,6 +36,8 @@ export default {
this.restoreUTMFromSessionStorage();
this.storeUTMToSessionStorage();
this.getFbClickIdFromCookie();
// TODO: split internalMedium into a new separate field
this.utmMedium = this.utmMedium || this.internalMedium;
},
methods: {
setUTMProps({ utmCampaign, utmSource, utmMedium }) {
Expand Down
9 changes: 8 additions & 1 deletion src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@
:cover-resize="300"
:is-link-disabled="stickyBookstoreItem.isMultiple"
:is-lazy-loaded="false"
:internal-medium="'index_sticky_item'"
@click-cover="handleClickItem($event, stickyBookstoreItem)"
/>
</div>
Expand All @@ -421,6 +422,7 @@
class-cover-frame-aspect-ratio="min-h-[360px] laptop:min-h-[0] aspect-[4/5]"
:cover-resize="300"
:is-link-disabled="item.isMultiple"
:utm-medium="$route.query.utm_medium || 'index_bookstore_item'"
@click-cover="handleClickItem($event, item)"
/>
</li>
Expand Down Expand Up @@ -452,6 +454,9 @@
<NFTBookItemCardV2
:item-id="item.classId"
class-cover-frame-aspect-ratio="aspect-[4/5]"
:utm-medium="
$route.query.utm_medium || 'index_bookstore_item_swiper'
"
@click-cover="handleClickItem($event, item)"
/>
</SwiperSlide>
Expand Down Expand Up @@ -571,7 +576,9 @@
name: 'store',
query: {
tag: 'autograph',
utm_source: 'landing_page_signature_banner_cta',
utm_medium:
$route.query.utm_medium ||
'landing_page_signature_banner_cta',
},
})
"
Expand Down
16 changes: 16 additions & 0 deletions src/pages/store/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@
:item-id="item.classId"
class-cover-frame-aspect-ratio="aspect-[4/5]"
:is-link-disabled="item.isMultiple"
:utm-medium="utmMedium"
@click-cover="handleClickItem($event, item)"
/>
</li>
Expand Down Expand Up @@ -706,6 +707,21 @@ export default {
}
return baseUrl;
},
internalMedium() {
const {
query: { ll_medium: qsMedium, tag, q },
} = this.$route;
if (qsMedium) {
return qsMedium;
}
if (tag) {
return `tag-${tag}`;
}
if (q) {
return 'search';
}
return '';
},
// Price filter related
priceFilterList() {
return [
Expand Down

0 comments on commit a86bb3f

Please sign in to comment.