Use this file to discover all available pages before exploring further.
The primary way to install Grain. Perfect for any website — landing pages, static sites, CMSs, or full web apps. No build tools required.Grain Tag automatically tracks page views, clicks, scroll depth, heatmaps, and DOM snapshots with zero code. Just add the script and you’re collecting data.
Replace your-tenant-id with your tenant identifier (not UUID) from your dashboard.That’s it! Grain is now loaded and tracking page views, heatmap clicks, scroll depth, and DOM snapshots automatically.
<script> const grain = GrainTag.getInstance(); // When user logs in — pass only the user ID function handleLogin(userId) { grain.identify(userId); // Track login event grain.track('user_logged_in', { method: 'email' }); }</script>
Grain Tag automatically tracks page views on initial load and hooks into the History API (pushState / replaceState) to track navigation in single-page apps. No manual page view tracking is needed for most SPAs.If your app uses custom routing that does not go through the History API, you can track navigation manually:
<script> const grain = GrainTag.getInstance(); // Only needed for custom routing that bypasses the History API function navigateTo(url) { // Your custom navigation logic... grain.track('page_viewed', { page: url }); }</script>