diff --git a/apps/www/pages/r/[id].tsx b/apps/www/pages/r/[id].tsx index fbe936c74..9d185302a 100644 --- a/apps/www/pages/r/[id].tsx +++ b/apps/www/pages/r/[id].tsx @@ -1,6 +1,7 @@ import * as React from 'react' import type { GetServerSideProps } from 'next' import dynamic from 'next/dynamic' +import * as gtag from 'utils/gtag' const IFrameWarning = dynamic(() => import('components/IFrameWarning'), { ssr: false, @@ -16,9 +17,21 @@ interface RoomProps { export default function Room({ id }: RoomProps) { if (typeof window !== 'undefined' && window.self !== window.top) { + gtag.event({ + action: 'connect_to_room_in_iframe', + category: 'v1', + label: id, + value: 0, + }) return } + gtag.event({ + action: process.env.NODE_ENV === 'production' ? 'connect_to_room' : 'connect_to_room_dev', + category: 'v1', + label: id, + value: 0, + }) return } diff --git a/apps/www/pages/v/[id].tsx b/apps/www/pages/v/[id].tsx index d369ee3fc..6a86b7e85 100644 --- a/apps/www/pages/v/[id].tsx +++ b/apps/www/pages/v/[id].tsx @@ -1,6 +1,7 @@ import * as React from 'react' import type { GetServerSideProps } from 'next' import dynamic from 'next/dynamic' +import * as gtag from 'utils/gtag' import { Utils } from '@tldraw/core' const IFrameWarning = dynamic(() => import('components/IFrameWarning'), { @@ -17,9 +18,26 @@ interface RoomProps { export default function Room({ id }: RoomProps) { if (typeof window !== 'undefined' && window.self !== window.top) { + gtag.event({ + action: 'connect_to_readonly_room_in_iframe', + category: 'v1', + label: id, + value: 0, + }) + return } + gtag.event({ + action: + process.env.NODE_ENV === 'production' + ? 'connect_to_readonly_room' + : 'connect_to_readonly_room_dev', + category: 'v1', + label: id, + value: 0, + }) + return }