chore: Track embed views (#3726)

This commit is contained in:
Benjamin Ottensten
2024-12-20 13:16:33 +01:00
committed by GitHub
parent 67f395eeff
commit 5d44cf1bbc
2 changed files with 12 additions and 8 deletions
@@ -43,9 +43,6 @@
Copy this code to embed your model in a webpage or document.
</p>
<LayoutDialogSection border-b border-t title="Options">
<template #icon>
<Cog6ToothIcon class="h-full w-full" />
</template>
<div class="flex flex-col gap-1.5 sm:gap-2 text-body-xs cursor-default">
<div v-for="option in embedDialogOptions" :key="option.id">
<label
@@ -73,9 +70,6 @@
border-b
title="Preview"
>
<template #icon>
<EyeIcon class="h-full w-full" />
</template>
<ProjectModelPageDialogEmbedIframe
v-if="!isSmallerOrEqualSm"
:src="updatedUrl"
@@ -92,7 +86,6 @@
</template>
<script setup lang="ts">
import { Cog6ToothIcon, EyeIcon } from '@heroicons/vue/24/outline'
import {
ProjectVisibility,
type ProjectsModelPageEmbed_ProjectFragment
@@ -195,7 +188,7 @@ const isPrivate = computed(() => {
const discoverableButtons = computed((): LayoutDialogButton[] => [
{
text: 'Cancel',
text: 'Close',
props: { color: 'outline' },
onClick: () => {
isOpen.value = false
@@ -123,6 +123,7 @@ import { useViewerTour } from '~/lib/viewer/composables/tour'
import { useFilterUtilities } from '~/lib/viewer/composables/ui'
import { projectsRoute } from '~~/lib/common/helpers/route'
import { workspaceRoute } from '~/lib/common/helpers/route'
import { useMixpanel } from '~/lib/core/composables/mp'
const emit = defineEmits<{
setup: [InjectableViewerState]
@@ -198,4 +199,14 @@ const lastUpdate = computed(() => {
})
useHead({ title })
const mp = useMixpanel()
onMounted(() => {
const referrer = document.referrer
const shouldTrackEvent = !referrer?.includes('speckle.systems') && !import.meta.dev
if (isEmbedEnabled.value && shouldTrackEvent) {
mp.track('Embedded Model Load')
}
})
</script>