Skip to content

Commit

Permalink
Merge pull request #1 from MarcosRamirez/Dev
Browse files Browse the repository at this point in the history
added Google Analytics Component
  • Loading branch information
MarcosRamirez authored Feb 15, 2024
2 parents d19064a + 9a62b28 commit fdea7b5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 11 deletions.
6 changes: 6 additions & 0 deletions public/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
min-width: 0;
}

img {
display: block;
max-width: 100%;
}

html, body, main {
font-family: 'Roboto', sans-serif;
padding: 0.5em 0.5em 0.5em 0.5em;
Expand All @@ -24,6 +29,7 @@ html, body, main {
display: flex;
justify-content: center;
align-items: center;

}

main {
Expand Down
23 changes: 23 additions & 0 deletions src/components/GoogleAnalytics.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
const { gtagId } = Astro.props;
const url="https://www.googletagmanager.com/gtag/js?id="+gtagId;
---

<!-- Global site tag (gtag.js) - Google Analytics -->
<script
is:inline
async
src={url}>
</script>

<script is:inline
define:vars={{gtagId}}
>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
tag("config", gtagId );

</script>
11 changes: 2 additions & 9 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const { title, description, keywords } = Astro.props;
import Header from "../components/Header.astro"
import Footer from "../components/Footer/Footer.astro"
import GoogleAnalytics from "../components/GoogleAnalytics.astro"
---

<html lang="es">
Expand All @@ -15,15 +16,7 @@ import Footer from "../components/Footer/Footer.astro"
<meta name="generator" content={"Marcos Ramirez with: " + Astro.generator} />
<meta name="keywords" content={keywords} />

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3XNP18HWLJ"></script>
<script is:inline>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-3XNP18HWLJ');
</script>
<GoogleAnalytics gtagId='G-3XNP18HWLJ' />

<title>{title}</title>

Expand Down
5 changes: 3 additions & 2 deletions src/pages/cumpleanos.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import Layout from "../layouts/Layout.astro";
import Layout from '../layouts/Layout.astro';
import Link from '../components/Link.astro';
---

<Layout title="No sabes que regalarme por mi cumpleaños?"
Expand All @@ -19,7 +20,7 @@ description="sugerencias para hacer un regalo de cumpleaños a Marcos Ramírez"
<li><a href="https://www.amazon.es/hz/wishlist/ls/3W4Z9QV85RRO5?ref_=wl_share" rel="nofollow" target="_blank">Cosas para la bici</a></li>
<li><a href="https://www.amazon.es/hz/wishlist/ls/2QNS1H3JEUH0V?ref_=wl_share" rel="nofollow" target="_blank">Ropa</a></li>
<li><a href="https://www.amazon.es/hz/wishlist/ls/1S1NVYBRXUSQX?ref_=wl_share" rel="nofollow" target="_blank">Chorradas varias que se me antojan 🤣🤣</a></li>

<li><Link href='https://ringconn.com/'> </li>
</ul>
</ul>

Expand Down

0 comments on commit fdea7b5

Please sign in to comment.