Google Analytics
Google Analytics is supported out of the box for tracking public page views.
Obtaining your tracking ID
If you haven't done so already, head over to your Google Analytics dashboard and create a new property for your website. Once created, you will obtain a tracking ID, which is either a Google Analytics 4 property, or for legacy configurations, a Universal Analytics property.
Adding the tracking ID to your project
Head over to the motif.json
configuration file (open search using and type motif.json
).
If you are using Google Analytics 4 properties, add an entry named gaMeasurementId
, replacing G-XXXXXXXX
with your tracking ID:
{"gaMeasurementId": "G-XXXXXXXX","head": ["..."]}
If you are using Universal Analytics properties, add an entry named gaTrackingId
, replacing UA-XXXXXXXX
with your tracking ID:
{"gaTrackingId": "UA-XXXXXXXX","head": ["..."]}
Google Optimize
Similarly to Analytics, Google Optimize works out-of-the-box. Head over to your Google Optimize dashboard and obtain a tracking code. In your motif.json
configuration file, add the Optimize script to the head section, as follows:
{"head": ["...","<script src='https://www.googleoptimize.com/optimize.js?id=OPT-XXX'></script>"]}
replacing OPT-XXX
with your tracking id. Google Optimize is now enabled across all the public pages of your project.