Astro Google Analytics Integration - Quick & Easy
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
Thanks.
Did my own by following the guide
Thanks Stefan. You saved my life with this great video and great explanation
Cheers!
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!
Great to hear! Wishing you the best of luck on your journey!!
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"],
},
}),
],
});
```
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.
For folks using the new starter template, the component should be in imported into layouts/Base.Astro
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?
Thank you for the guide! I’m getting CORS error 😢 is there any chance you know how to handle it? Thank you again!
Thanks for you video from Chile 🇨🇱
This was really helpful. Thanks! Subscribing for more.
Stefan, i really appreciate you making this video, however i have a question. how is it possible to create custom events?
Do you really need an extra plugin for that? Couldn't you just add for the analytics?
I don't know? Can you? I followed the recommended way according to the Astro.build documentation on this one.
@@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..
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.
"""
@@rafaelsanabria5936 Ah ok, now I understand, thank you. Just trying to make sense out of all this stuff as a beginner…
astro oauth2 ? 😅