WordPress
Two ways to install Glyphex on WordPress: the plugin, or a manual snippet in your header.
Option 1: Use the plugin
The Glyphex Analytics plugin is coming to wordpress.org. Until then, download the zip from GitHub (github.com/glyphexio/glyphex-wordpress) and install it yourself.
In the plugin settings you can skip logged-in administrators, and exclude search strings and hash fragments from page URLs.
- Download the latest zip from https://github.com/glyphexio/glyphex-wordpress.
- In WordPress, go to Plugins > Add New Plugin > Upload Plugin, choose the zip, and click Install Now.
- Click Activate.
- Go to Settings > Glyphex and paste your Site ID. Find it in your Glyphex site settings.
- Save changes.
Option 2: Manual snippet
- Copy your Site ID from your Glyphex site settings.
- Install a header-injection plugin such as WPCode or Insert Headers and Footers, or edit your theme's header.php (use a child theme so updates do not overwrite it).
- Paste the snippet below into the header section, before the closing </head> tag.
- Save and clear any page cache.
The snippet
Replace SITE_ID with the ID from your Glyphex site settings.
<script defer src="https://glyphex.io/t/SITE_ID.js"></script>
Verify it works
Open your live site in a new tab, then open Realtime in your Glyphex dashboard. Your visit should show up within a few seconds.
Track custom events
Add the data attributes to any element in the block editor. Use a Custom HTML block for buttons and links:
<button data-glyphex-event="signup_click" data-glyphex-event-plan="pro" > Sign up </button>
Events can also be sent with window.analytics.track(name, props) or the declarative data-glyphex-event and data-glyphex-event-<prop> attributes.
Troubleshooting
- No data? Check that the Site ID matches exactly and the page was republished or the cache cleared.
- Ad blockers can block analytics scripts. Disable yours to test.
- Content Security Policy: allow https://glyphex.io in both script-src and connect-src.
- Check DevTools > Network for a request to glyphex.io/t/. A 404 means the Site ID is wrong.