{"id":2089,"date":"2024-04-21T21:34:58","date_gmt":"2024-04-21T19:34:58","guid":{"rendered":"https:\/\/trackboxx.com\/?post_type=helpcenter&#038;p=2089"},"modified":"2025-11-28T11:00:03","modified_gmt":"2025-11-28T10:00:03","slug":"how-do-i-integrate-the-tracking-script-into-my-site","status":"publish","type":"helpcenter","link":"https:\/\/trackboxx.com\/en\/helpcenter\/wie-binde-ich-das-tracking-script-in-meine-seite-ein","title":{"rendered":"Add the Trackboxx tracking script"},"content":{"rendered":"<p class=\"wp-block-paragraph\">To ensure Trackboxx records your visitors reliably, you need to add the <strong>tracking script<\/strong> to your website. You only need to do this once; after that, Trackboxx automatically tracks every page view.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where should the tracking script go?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Add the script to the <strong>header of your website<\/strong> , between<br><span style=\"color: #0f0e17;background-color: #eef3f3\" class=\"stk-highlight\"><code>&lt;head><\/code> and <code>&lt;\/head><\/code><\/span>.<br>This ensures that <strong>all pages on your website are tracked<\/strong> .<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Get your personal tracking code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A pop-up will then appear with your <strong>personal tracking code<\/strong>.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to the Trackboxx dashboard.<\/li>\n\n\n\n<li>Add a new website (name + URL).<\/li>\n\n\n\n<li>A pop-up will then appear with your <strong>personal tracking code<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Here is an example of what the code looks like:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"javascript\">\n  (<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\">d, s, id, w, f<\/span>)<\/span>{\n      w[f] = w[f] || <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\"><\/span>) <\/span>{\n          (w[f].q = w[f].q || []).push(<span class=\"hljs-built_in\">arguments<\/span>)\n      };\n      <span class=\"hljs-keyword\">var<\/span> js, fjs = d.getElementsByTagName(s)[<span class=\"hljs-number\">0<\/span>];\n      <span class=\"hljs-keyword\">if<\/span> (d.getElementById(id)){ <span class=\"hljs-keyword\">return<\/span>; }\n      js = d.createElement(s); js.id = id;\n      js.onload = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>{\n          <span class=\"hljs-comment\">\/\/ remote script has loaded<\/span>\n      };\n      js.async = <span class=\"hljs-literal\">true<\/span>;\n      js.src = <span class=\"hljs-string\">\"https:\/\/cdn.trackboxx.info\/p\/tracker.js\"<\/span>;\n      fjs.parentNode.insertBefore(js, fjs);\n  }(<span class=\"hljs-built_in\">document<\/span>, <span class=\"hljs-string\">'script'<\/span>, <span class=\"hljs-string\">trackboxx-script'<\/span>, <span class=\"hljs-built_in\">window<\/span>, <span class=\"hljs-string\">trackboxx'<\/span>));\n  trackboxx(<span class=\"hljs-string\">'set'<\/span>, <span class=\"hljs-string\">siteId'<\/span>, <span class=\"hljs-string\">'TB-66377283'<\/span>);\n  trackboxx(<span class=\"hljs-string\">trackPageview'<\/span>);\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Important: This is only an example. You will find your personal code in the dashboard after clicking Add website.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Once the code is installed, Trackboxx starts tracking visits to your website.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add the tracking script to WordPress<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress offers several ways to add the code to your site's header. The best method depends on your setup, theme, and technical experience.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. header.php (manual integration)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can add the code directly to your theme's <strong>header.php<\/strong> file.<br>Important: use a <strong>child theme<\/strong>, otherwise the code will be overwritten during the next update.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Code fields in the theme settings<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Many modern themes include a field for adding code to the header, usually in the theme options or Customizer.<br>This is common in page-builder themes such as Avada, Divi, and Enfold.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Hooks and theme integrations<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Some themes and frameworks provide <strong>hooks<\/strong>that let you add code cleanly to the header, often without editing a file directly.<br>Check your theme's documentation for the correct hook.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Add the script with a plugin<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Many plugins are designed to add <strong>tracking and header scripts<\/strong> to WordPress.<br>Simply search for:<br>\"WordPress Header Script Plugin\" or \"WordPress Tracking Script Plugin\".<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to use <strong>e-commerce tracking<\/strong> with WooCommerce, for example, we recommend a plugin because it handles the additional setup more easily.<\/p>","protected":false},"featured_media":0,"template":"","categories":[],"tags":[32],"class_list":["post-2089","helpcenter","type-helpcenter","status-publish","hentry","tag-helpcenter-erste-schritte"],"acf":[],"_links":{"self":[{"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/helpcenter\/2089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/helpcenter"}],"about":[{"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/types\/helpcenter"}],"version-history":[{"count":0,"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/helpcenter\/2089\/revisions"}],"wp:attachment":[{"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/media?parent=2089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/categories?post=2089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/tags?post=2089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}