Skip to content

Commit

Permalink
docs: add page_view track event example (closes #76)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Jun 25, 2024
1 parent 57e7a9f commit faeaf1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
// Enable the ESLint flat config support
"eslint.experimental.useFlatConfig": true,
"eslint.useFlatConfig": true,

// Disable the default formatter, use ESLint instead
"prettier.enable": false,
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ const { gtag, initialize } = useGtag()

function acceptTracking() {
initialize('G-XXXXXXXXXX')
// Optionally, track the current page view
// useTrackEvent('page_view')
}
```

Expand Down Expand Up @@ -296,7 +298,11 @@ The function accepts an optional ID in case you want to initialize a custom Goog
const { initialize } = useGtag()

// Load the `gtag.js` script and initialize all tag IDs from the module options
initialize()
function acceptTracking() {
initialize()
// Optionally, track the current page view
// useTrackEvent('page_view')
}
```

> [!TIP]
Expand Down

0 comments on commit faeaf1e

Please sign in to comment.