Destiner / astro-analytics

Astro components for site analytics
MIT License
113 stars 11 forks source link

apiKey undefined for Amplitude #29

Open davidleger95 opened 7 months ago

davidleger95 commented 7 months ago

For some reason, the apiKey prop isn't being passed through to the amplitude script properly.

I'm using TypeScript, so I'm wondering if the transpile step is losing context.

<!-- Layout.astro -->
<!-- ... -->
<!doctype html>
<html 
    lang="en"
    transition:animate={fade({ duration: '1s' })}
>
    <head>
        <meta charset="UTF-8" />
        <meta name="image" property="og:image" content={ SHARE_IMAGE }>
        <meta name="description" content={ DESCRIPTION } />
        <meta name="viewport" content="width=device-width" />
        <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
        <meta name="generator" content={Astro.generator} />
        <title>{ pageTitle }</title>
        <Amplitude apiKey="MY_REAL_KEY_OBVIOUSLY" />
        <ViewTransitions />
    </head>
    <body>
    <!-- ... -->
image
nlxdodge commented 5 months ago

I think it also has to do with this issue that me and others spotted as well.

https://github.com/Destiner/astro-analytics/issues/25

It seems like the code from Amplitude always loads, regardless and I think that implementation is just broken.

sanjayatony commented 5 months ago

I have the same issue