beyonk-group / gdpr-cookie-consent-banner

A GDPR compliant cookie consent banner implementation
MIT License
248 stars 42 forks source link

This doesn't work with svelte/astro #46

Closed Fischchen closed 12 months ago

Fischchen commented 1 year ago

When trying to use this with Astro, It never shows the banner and just the little cookie in the corner. Furthermore, it says Cannot find name 'initAnalytics'

Doses this just not work with Astro or have I done something wrong? I put the svelte object in the body.

I have this in my body:

<GdprBanner cookieName="foo" description="bar" on:analytics={initAnalytics} />

<script>
  import '@beyonk/gdpr-cookie-consent-banner/dist/style.css' // optional, you can also define your own styles
  import GdprBanner from '@beyonk/gdpr-cookie-consent-banner'

  function initAnalytics () {
    // do something with segment.io or google analytics etc
    alert('analytics enabled')
  }
</script>
antony commented 1 year ago

Hey @Fischchen - I've never used Astro, so I can't be sure what the problem is here.

It seems like everything that you've done is right, so I'm puzzled.

antony commented 12 months ago

Hey @Fischchen - since I've not heard from you, and I don't use Astro, I'm going to close this.

Feel free to reopen if you have more info.