-
Notifications
You must be signed in to change notification settings - Fork 4
Analytics
Scigateway
uses Google Analytics to track page views and user events. To do so, it uses the react-ga
library.
You need to supply a Google Analytics (GA) tracking ID for the site to be able to send data to your GA account. This can be done via going to analytics.google.com
, and clicking on the cog in the bottom left to get to the Admin page. Clicking on Property > Property Settings
should display the tracking ID at the top of the page - it is in the format UA-XXXXXXX-X
where X are numbers.
The frontend uses anonymised IP address by default so we aren't tracking any personal data.
The scigateway.middleware.tsx
file handles sending pageviews to GA. To send an event, see the below syntax
ReactGA.event({
category: "Your category",
action: "Your action"
});
where category
is used to collect related events together and action
uniquely identifies the event performed. e.g. Login category and "Successfully logged in via X" and "Failed to log in via X" actions.
Plugins can rely on the fact that react-ga
has already been initialised by the parent app if the user has consented, and so they only need to interact with GA to send their own events. However, if a plugin is not hosted by the parent the plugin will need to initialise react-ga
itself. This should only be done when developing as otherwise GA will be initialised without considering the user's consent (unless you read the consent cookie before initialising).
This is the initialisation that the parent app does
ReactGA.initialize("UA-XXXXXXX-X", {
titleCase: false,
gaOptions: {
cookieExpires: 60 * 60 * 24 * 365, // one year
},
});
ReactGA.set({
anonymizeIp: true,
});
Consider running ReactGA in debug mode, as this will print any GA actions to the console.
ReactGA.initialize("UA-XXXXXXX-X", {
titleCase: false,
debug: true
gaOptions: {
cookieExpires: 60 * 60 * 24 * 365, // one year
},
});
ReactGA.set({
anonymizeIp: true,
});
The parent app will be in control of sending pageviews to GA, but plugins should send their own events via the method outlined above
-
Architecture
-
Dev environment
-
Developing a plugin
-
Deployment
- Deploying SciGateway
- SciGateway Settings
- Deploying plugins
-
Releasing
-
Plugins
-
Continuous Integration
-
UX
-
Feedback