-
Notifications
You must be signed in to change notification settings - Fork 7
fix(recommendations): prepping recommendations to fire impression events for analytics #58
fix(recommendations): prepping recommendations to fire impression events for analytics #58
Conversation
…nts for analytics
const target = ref<HTMLDivElement>() | ||
const { isActive } = useIntersectionObserver(target, checkIntersection) | ||
|
||
function checkIntersection([{ isIntersecting }]: [{ isIntersecting: boolean }]): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line hurts to dissect at first but got better afterwards 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like it, too. I could probably add some line breaks to make it a little easier to grok.
</div> | ||
</NuxtLink> | ||
</template> | ||
<RecommendationArticle v-for="item in recommendations" :key="item.id" :item="item" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the key changing from item.tileId
intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! This matches up with the new API.
It should have been done before, but since we weren't using this value for anything it was missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!!
One question and something that could be addressed in a separate PR - the ticket mentions An impression should fire when a % of it is visible on the screen. Make this % adjustable for now.
. I confirmed with Daniel that this can be a simple config variable and not something that like an admin or someone needs access to. We could do that by adding a threshold
, right?
Goal
Prep recommendations to send analytics events
To Do:
Implementation Decisions
My work with the intersection observer was based on the @vueuse/core package.