Astro Google Analytics Integration - Quick & Easy

Sdílet
Vložit
  • čas přidán 20. 11. 2022
  • Learn how to integrate Google Analytics 4 into your Astro project!
    Written Guide: www.ceos3c.com/web-developmen...
    WSL2 Course: www.udemy.com/course/the-comp...
    WSL2 Series: www.ceos3c.com/category/wsl-2/
    ⮘-=[⭐All important links in one place⭐]=-⮚
    ↬ linktree.stefanrows.com
    ⮘-=[⭐All the stuff I use⭐]=-⮚
    ↬ www.amazon.com/shop/ceos3ctut...
    ⮘-=[⭐Join this channel to get access to perks⭐]=-⮚
    / @stefanrows
    ⮘-=[Subscribe]=-⮚
    ↬ czcams.com/users/stefanrows?su...
    ⮘-=[Sign Up to my popular 5-Bullet-Friday Newsletter]=-⮚
    ↬eepurl.com/cNJ_Dj
    ⮘-=[100$ Credit on Digital Ocean for your VPS Droplet]=-⮚
    ↬ m.do.co/c/b4f1d6f76c49
    ⮘-=[Get a HUGE discount for the best VPN provider out there: NordVPN]=-⮚
    ↬ nordvpn.org/ceos3c
    ⮘-=[Increase your Blog Revenue with Ezoic's AI]=-⮚
    ↬www.ceos3c.com/reviews/ezoic-...
    ⮘-=[Support Me]=-⮚
    ↬ Coffee: www.buymeacoffee.com/stefanrows
    ↬ Patreon: / stefanrows
    ↬ Hacking Apparel: www.teespring.com/stores/ceos...
    ↬ Paypal: www.paypal.me/ceos3c
    ↬ pfSense Starter Guide: amzn.to/2RbRem2
    ↬ CZcams Membership: / @stefanrows
    ⮘-=[ Join us on Twitch for regular Live Streams & Events ]=-⮚
    ↬ / ceos3c
    ⮘-=[Socials]=-⮚
    ↬ Discord: / discord
    ↬ Website: www.ceos3c.com
    ↬ Twitter: / ceos3c
    ↬ Facebook: / ceos3c
    ↬ Instagram: / stefanrows
    ⮘-=[Affiliate]=-⮚
    Ceos3c is part of the Amazon Affiliate Program.
    Ceos3c is part of the NordVPN Affiliate Program.
    Ceos3c is part of the Ezoic Affiliate Program.
    Ceos3c is part of the Digital Ocean Affiliate Program.
  • Věda a technologie

Komentáře • 19

  • @ElenaBG3
    @ElenaBG3 Před 2 měsíci

    Thanks.
    Did my own by following the guide

  • @danielribes5433
    @danielribes5433 Před měsícem

    Thanks Stefan. You saved my life with this great video and great explanation

  • @renoob879
    @renoob879 Před rokem +1

    This is really helpful! I've been learning web dev for a while, and I'm currently building my first ever project using astro and svelte. It's been really hard to find astro tutorials, and you give me just what I need!

    • @StefanRows
      @StefanRows  Před rokem

      Great to hear! Wishing you the best of luck on your journey!!

  • @SebFehr
    @SebFehr Před rokem +5

    To make this work, I also had to configure astro.config.mjs wtih:
    ```
    import { defineConfig } from "astro/config";
    import partytown from "@astrojs/partytown";
    export default defineConfig({
    integrations: [
    partytown({
    // Adds dataLayer.push as a forwarding-event.
    config: {
    forward: ["dataLayer.push"],
    },
    }),
    ],
    });
    ```

    • @DanielByronYT
      @DanielByronYT Před rokem +2

      Yeah it wasnt working for me either. But I found another blog post about this that led me to this code. This is a pretty big issue. This comment should be pinned or something.

  • @martincasilda1
    @martincasilda1 Před 10 měsíci

    For folks using the new starter template, the component should be in imported into layouts/Base.Astro

  • @ricardosnotes
    @ricardosnotes Před 4 měsíci

    Thanks for the video, i tried everything to make google analytics work with the astro starlight theme but nothing worked, can you maybe give it a go?

  • @lvekua
    @lvekua Před 11 měsíci

    Thank you for the guide! I’m getting CORS error 😢 is there any chance you know how to handle it? Thank you again!

  • @naseroc
    @naseroc Před rokem

    Thanks for you video from Chile 🇨🇱

  • @itanio
    @itanio Před rokem

    This was really helpful. Thanks! Subscribing for more.

  • @orkunvemosi
    @orkunvemosi Před 5 měsíci

    Stefan, i really appreciate you making this video, however i have a question. how is it possible to create custom events?

  • @BG-xu8be
    @BG-xu8be Před rokem

    Do you really need an extra plugin for that? Couldn't you just add for the analytics?

    • @StefanRows
      @StefanRows  Před rokem

      I don't know? Can you? I followed the recommended way according to the Astro.build documentation on this one.

    • @BG-xu8be
      @BG-xu8be Před rokem +1

      @@StefanRows Ok thanks, but I tried with an inline script-tag and it did work, so I was wondering where is the benefit of that..

    • @rafaelsanabria5936
      @rafaelsanabria5936 Před rokem +2

      From the docs
      """
      Partytown is a lazy-loaded library to help relocate resource intensive scripts into a web worker, and off of the main thread.
      If you’re using third-party scripts for things like analytics or ads, Partytown is a great way to make sure that they don’t slow down your site.
      """

    • @BG-xu8be
      @BG-xu8be Před rokem +1

      @@rafaelsanabria5936 Ah ok, now I understand, thank you. Just trying to make sense out of all this stuff as a beginner…

  • @0xbarb
    @0xbarb Před rokem

    astro oauth2 ? 😅