Configuration
The 99dev analytics tracking snippet can be configured in a number of ways and includes sensible defaults for most websites.
Script Parameters
When using tracker directly via the <script>
tag, you can include a number of parameters:
- Site UUID (required) - Which site to associate the traffic with
- API URL - Where to load the pixel from. Useful for proxying.
- Watch - Set to “hash” for SPAs using hash navigation or “history” for SPAs using the History API.
- Debug - Include to emit console logs to see how the analytics are interpreting the current page.
index.html
<script
src="https://cdn.99.dev/analytics.js"
data-site-uuid="f6231a58-eca5-4902-94b0-192ad4030188"
data-api-url="https://api.99.dev"
data-watch="hash"
async
></script>
Module Parameters
When using the tracker via JS/TS module, you can pass an options object as the secondary parameter to the init
function call. See our script API docs for a complete list. Key options include:
navType
of either “hash” or “history”apiUrl
for proxying to the 99dev API
main.ts
// Include the analytics code
import * as analytics from "@99devco/analytics"
// Initialize the tracker for SPA
analytics.init("your-site-id-goes-here", {
navType: "hash",
apiUrl: "https://99devproxy.yoursite.com",
})
// Manually trigger page record since we used "dontRecordView" during init
analytics.recordView("/some/optional/specific-overload-url");
Meta Tags
99dev analytics supports a number of page meta tags to customize tracking behavior, namely canonical links or non-canonical page overload via custom 99dev-page meta.
99dev will honor any canonical links it finds when recording traffic:
index.html
<head>
<link rel="canonical" href="https://example.com/dresses/green-dresses" />
</head>
However, canonical links impact SEO and a variety of default web behaviors so 99dev also provides a custom meta for overloading the recorded page URL without those side effects:
index.html
<head>
<meta name="99dev-page" content="/patients/patient-details">
</head>
These meta tags are especially useful for instances where lookup IDs are provided via URL and/or PII or PHI are present in the URL.