A worked example, rendered from real sample data. Sign in to run the tool on your own input.
GA-123456789
page_view
button_click
form_submit
search{
"trackingId": "GA-123456789",
"platform": "google-analytics",
"events": [
{
"name": "page_view",
"props": [
"page",
"referrer"
]
},
{
"name": "button_click",
"props": [
"value",
"category"
]
},
{
"name": "form_submit",
"props": [
"value",
"category"
]
},
{
"name": "search",
"props": [
"value",
"category"
]
}
],
"config": {
"trackPageView": true,
"trackErrors": true,
"anonymizeIp": true
},
"implementation": {
"type": "gtag",
"scriptUrl": "https://www.googletagmanager.com/gtag/js?id=GA-123456789",
"initCode": "window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'GA-123456789');"
}
}Build analytics tracking code with event configuration and implementation details. Part of the DevTools Surf developer suite. Browse more tools in the Web / Frontend collection.