Skip to content
PricingDocs
All Integrations
Google Tag Manager

Device Intelligence for Google Tag Manager

Load the Device Identification agent via a GTM Custom HTML tag. Add visitor identification, bot detection, and smart signals to your Google Tag Manager application in minutes.

Quick Install

Add the SDK to your project with your preferred package manager.

npmnpm install gtm-template
yarnyarn add gtm-template
pnpmpnpm add gtm-template

Basic Usage

Get up and running with the minimal setup.

$html
<!-- GTM Custom HTML Tag -->
<script>
(function() {
var script = document.createElement('script');
script.src = 'https://your-domain.com/tracio-agent.js';
script.onload = function() {
Tracio.load({ apiKey: 'your-key' })
.then(tc => tc.get())
.then(result => {
dataLayer.push({
event: 'tracio_loaded',
visitorId: result.visitorId
});
});
};
document.head.appendChild(script);
})();
</script>

Advanced Patterns

Production-ready patterns with error handling, loading states, and advanced configuration.

Full GTM Integration with Data Layer Push — Click to expand
<!-- GTM Custom HTML Tag production setup -->
<script>
(function() {
var script = document.createElement('script');
script.src = 'https://your-domain.com/tracio-agent.js';
script.async = true;
script.onerror = function() {
dataLayer.push({
event: 'tracio_error',
tracio_error_message: 'Failed to load agent script',
});
};
script.onload = function() {
Tracio.load({
apiKey: 'your-key',
endpoint: 'https://your-domain.com/fp',
region: 'eu',
})
.then(function(tc) { return tc.get({ extendedResult: true }); })
.then(function(result) {
dataLayer.push({
event: 'tracio_loaded',
visitorId: result.visitorId,
confidence: result.confidence.score,
incognito: result.incognito,
botDetected: result.bot && result.bot.result !== 'notDetected',
requestId: result.requestId,
});
})
.catch(function(err) {
dataLayer.push({
event: 'tracio_error',
tracio_error_message: err.message,
});
});
};
document.head.appendChild(script);
})();
</script>

Configuration Options

All available options for initializing and configuring the SDK.

apiKeystringYour API key from the dashboard
endpointstringCustom endpoint URL for proxy-routed deployments
regionstringData region (us, eu, ap)
timeoutnumberRequest timeout in milliseconds
extendedResultbooleanAdds bot detection, incognito mode flags, and smart signals
linkedIdstringCustom identifier to associate visits (e.g. user ID or session ID)

Next Steps

Go deeper with the full API reference, webhook configuration, and advanced guides.

Get started with Google Tag Manager

Add device fingerprinting to your Google Tag Manager application in under 5 minutes.