Install the Agent
Install from Our CDN
The easiest way to get started is by including the script from our CDN, which will automatically install.
The script will load asynchronously, so you can safely place it anywhere in your markup. Most people will add it to the
<head> or at the end of the
Install with Google Tag Manager
It’s quick and easy to install Request Metrics with Google Tag Manager. Create a new Custom HTML Tag, and paste the following HTML into your tag configuration. Be sure to update YOUR_SITE_TOKEN.
You may also want to set the “Tag Firing Options” to “Once Per Page”.
Then, add a “Trigger”. You probably want a “Initialization - All Pages” trigger, so that the script runs on every page, but your configuration may vary.
Don’t forget to save the tag and publish to your site!
Install from NPM
Then reference the module and install it when initializing your application.
Additional Installation Patterns
The following are some common installation patterns from our customers. They are shown as CDN-based installs, but are adaptable to Google Tag Manager or NPM installations as well.
1. Install After User Consent
If you are subject to GDPR or other privacy regulation, you may want to get user consent before installing Request Metrics.
This code snippet loads the agent asynchronously and then calls the
installRM function, which will check your user consent state. If the user has not consented, nothing happens and you’ll need to call
installRM again as part of your user consent logic.
There is no issue with calling
RM.install multiple times.
2. Exclude URLs from Monitoring
You may want to exclude some development or testing URLs from monitoring. For example, excluding