Drupal
Integrate OnyxMetric Analytics with your Drupal site using the onyxmetric module
Drupal is a flexible and secure content management system that features robust content modeling and user management tools. You can add OnyxMetric to Drupal to track anonymous and logged-in users.
How to Add OnyxMetric to Drupal
You can add OnyxMetric to your site by installing the OnyxMetric module from Drupal.org
Get Your Tracking Script
First, you'll need your OnyxMetric tracking script. You can find this in your OnyxMetric dashboard under Site Settings > Tracking Code. It will look something like this:
<script defer src="https://app.onyxmetric.com/api/script.js" data-site-id="YOUR_SITE_ID"></script>Replace YOUR_SITE_ID with your actual Site ID from your OnyxMetric dashboard.
Download and install the OnyxMetric module
Follow Drupal's recommended procedure for installing the OnyxMetric module from https://www.drupal.org/project/onyxmetric:
$ composer require drupal/onyxmetric
$ drush en onyxmetricConfigure module settings
Visit admin/services/onyxmetric and add your Site ID to the site's configuration page.
You can also modify the script's source and loading optimizations, set rules for when the script gets loaded, and configure the site to use the identify() method to pass details about logged-in users from Drupal to OnyxMetric.
Verify Integration
Test Your Integration
- Open your live Drupal website in a browser.
- Navigate through a few pages.
- Check your OnyxMetric dashboard for incoming data. It might take a few minutes for the first events to appear.
That's it! OnyxMetric Analytics should now be integrated with your Drupal site.