Added affiliate parameters to scene URL.
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
<div class="page">
|
||||
<div class="header">
|
||||
<a
|
||||
:href="entity.url"
|
||||
:href="entityUrl"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="link link-child"
|
||||
:data-umami-event="entity.affiliate ? 'entity-click-aff' : 'entity-click'"
|
||||
:data-umami-event-aff-id="entity.affiliate?.id"
|
||||
:data-umami-event-entity="entity.slug"
|
||||
>
|
||||
<template v-if="entity.hasLogo">
|
||||
<img
|
||||
@@ -113,6 +116,23 @@ const children = ref(null);
|
||||
const expanded = ref(false);
|
||||
|
||||
const scrollable = computed(() => children.value?.scrollWidth > children.value?.clientWidth);
|
||||
|
||||
const entityUrl = (() => {
|
||||
if (!entity.url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!entity.affiliate?.parameters) {
|
||||
return entity.url;
|
||||
}
|
||||
|
||||
const newParams = new URLSearchParams({
|
||||
...Object.fromEntries(new URL(entity.url).searchParams),
|
||||
...Object.fromEntries(new URLSearchParams(entity.affiliate.parameters)),
|
||||
});
|
||||
|
||||
return `${entity.url}?${newParams}`;
|
||||
})();
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user