@aqzhyi/google-analytics
Advanced tools
Comparing version 0.3.1 to 0.3.2
{ | ||
"license": "MIT", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"name": "@aqzhyi/google-analytics", | ||
@@ -26,4 +26,3 @@ "description": "Google Analytics (GA4) library", | ||
"type": "git", | ||
"url": "https://github.com/Aqzhyi/oh-my-monorepo", | ||
"directory": "@aqzhyi/google-analytics" | ||
"url": "https://github.com/Aqzhyi/oh-my-monorepo/tree/main/%40aqzhyi/google-analytics" | ||
}, | ||
@@ -30,0 +29,0 @@ "keywords": [ |
@@ -11,41 +11,43 @@ # @aqzhyi/google-analytics | ||
## `<GoogleAnalytics />` (astro-component) | ||
## Usage (Astro) | ||
> Insert the GTM (Google Tag Manager) script into the Astro Layout and configure your Google Analytics ID, for example: `'G-G90JYXXXXX'`. | ||
### `<GoogleAnalytics />` | ||
###### pages/_layout/BasicLayout.astro | ||
> Insert the Google Tag Manager (GTM) script into the HTML using the Google Analytics ID you have configured (e.g., `'G-G90JYXXXXX'`). | ||
```astro | ||
--- | ||
import { GoogleAnalytics } from "@aqzhyi/google-analytics" | ||
--- | ||
1. `pages/_layout/BasicLayout.astro` | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<GoogleAnalytics id='G-G90JYXXXXX' /> | ||
</head> | ||
<body> | ||
<slot /> | ||
</body> | ||
</html> | ||
``` | ||
```astro | ||
--- | ||
import { GoogleAnalytics } from '@aqzhyi/google-analytics' | ||
--- | ||
###### pages/index.astro | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<GoogleAnalytics id='G-G90JYXXXXX' /> | ||
</head> | ||
<body> | ||
<slot /> | ||
</body> | ||
</html> | ||
``` | ||
``` | ||
--- | ||
import BasicLayout from "./_layout/BasicLayout.astro" | ||
--- | ||
1. `pages/index.astro` | ||
<BasicLayout> | ||
Page 1 | ||
</BasicLayout> | ||
``` | ||
``` | ||
--- | ||
import BasicLayout from "./_layout/BasicLayout.astro" | ||
--- | ||
###### Preview | ||
<BasicLayout> | ||
Page 1 | ||
</BasicLayout> | ||
``` | ||
> Preview | ||
![](https://raw.githubusercontent.com/Aqzhyi/mono/refs/heads/main/%40aqzhyi/google-analytics/public/works.png) | ||
## `<GoogleAnalytics debug />` (astro-component) | ||
### `<GoogleAnalytics debug />` | ||
@@ -59,2 +61,4 @@ ```astro | ||
> Preview | ||
![](https://raw.githubusercontent.com/Aqzhyi/mono/refs/heads/main/%40aqzhyi/google-analytics/public/debug-if-no-input.png) |
Sorry, the diff of this file is not supported yet
5466
63