-
Notifications
You must be signed in to change notification settings - Fork 1
Analytics
Andrew Hosgood edited this page Mar 6, 2024
·
1 revision
TNA Frontend comes with an analytics library.
The library is set up to track basic interactions from lots of the components.
There is support for Google Analytics 4 but you can extend the event listener library with your own suite if you wish.
- Include the
analytics.js
file that comes with TNA Frontend - this will set up aTNAFrontendAnalytics
object in thewindow
- Instantiate the GA4 class with
const analytics = new window.TNAFrontendAnalytics.GA4("my-id")
where"my-id"
is the ID of your Google Analytics property - Ensure your analytics instantiation is done AFTER the initialisation of the TNA Frontend components (
TNAFrontend.initAll()
)
- Import the GA4 library with
import { GA4 } from "@nationalarchives/frontend/nationalarchives/analytics.mjs";
- Instantiate the GA4 class with
const analytics = new GA4("my-id")
where"my-id"
is the ID of your Google Analytics property
[TODO]
[TODO]
[TODO]
[TODO]