Use Cases
Static Websites Track landing pages, portfolios, and static marketing sites built with plain HTML, CSS, and JavaScript. Custom Web Applications Add tracking to custom-built web apps without frameworks or build tools. Legacy Sites Track older websites that don’t use modern frameworks or CMS platforms. HTML Email Landing Pages Track standalone landing pages linked from email campaigns.Before You Start
- You have a DATALYR account
- You’ve created a workspace
- You have access to edit your HTML files
- Your site is hosted somewhere accessible
Step 1: Get Your Tracking Code
- Log in to your DATALYR dashboard
- Go to Settings → Tracking
- Copy your tracking script:
Step 2: Add to Your HTML
Open your HTML file and paste the tracking script in the<head> section, before the closing </head> tag:
YOUR_WORKSPACE_ID with your actual workspace ID from DATALYR.
Step 3: Add to All Pages
If you have multiple HTML pages, add the same tracking script to each page’s<head> section:
index.htmlabout.htmlcontact.html- Any other pages
Step 4: Upload and Test
- Upload your updated HTML files to your web host
- Visit your website in a new browser tab
- Go to your DATALYR dashboard
- Click Events in the sidebar
- You should see a
page_viewevent within 10 seconds
What Gets Tracked Automatically
Once installed, DATALYR automatically captures:- Page views on all pages
- Visitor IDs (persistent across sessions)
- UTM parameters from ad campaigns
- Ad click IDs (fbclid, gclid, ttclid)
- Referrer and traffic source
- Device and browser information
Track Form Submissions
Track form submissions as conversion events:<script> tag at the end of your page.
Track Button Clicks
Track specific button clicks or interactions:Track Newsletter Signups
Track email capture for newsletter signups:Track External Link Clicks
Track when users click links to external sites:<head> or before the closing </body> tag.
Track Downloads
Track file downloads (PDFs, images, etc.):Track Video Plays
Track when users play embedded videos:Identify Users
If you collect user information, identify users for cross-device tracking:Using Template Files
If you use server-side includes or templates, add the tracking script to your header template once: header.htmlTroubleshooting
Not seeing events? Check that:- Your tracking script is in the
<head>section of your HTML - You’ve uploaded the updated files to your web host
- Your workspace ID is correct
- Ad blockers are disabled
- Your site is accessible via HTTPS (recommended)
dl.js to see if it loaded successfully.
Events firing multiple times?
Make sure you only have one instance of the DATALYR script on each page. Search for track.datalyr.com in your HTML.
TypeError: datalyr is undefined?
The script hasn’t loaded yet. Wrap your tracking code in a check:
Next Steps
Verify Tracking
Confirm events are coming through
Track Custom Events
Learn event tracking API
Connect Integrations
Link Meta Ads, Google Ads, TikTok
View Your Dashboard
See your tracking data