{"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":"Integrate Trackboxx tracking script"},"content":{"rendered":"<p>In order for Trackboxx to reliably record visitors, the <strong>Tracking script<\/strong> be integrated into your website. The integration is a one-time process \u2013 after that, all page views are automatically recorded.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where should the tracking script go?<\/h3>\n\n\n\n<p>The script must be in the <strong>Header of your website<\/strong> be placed, i.e. between<br><span style=\"color: #0f0e17;background-color: #eef3f3\" class=\"stk-highlight\"><code>&lt;head><\/code> and <code>&lt;\/head><\/code><\/span>.<br>Only there can it be ensured that <strong>all subpages included<\/strong> become.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Obtain your personal tracking code<\/h3>\n\n\n\n<p>After that, a pop-up will appear with your <strong>individual 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>Create a new web page (name + URL).<\/li>\n\n\n\n<li>After that, a pop-up will appear with your <strong>individual tracking code<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p>The code looks like this, for example (example!):<\/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>Important! This is a sample code. You will get your personal code in your dashboard when you click Add Page.<\/p>\n<\/blockquote>\n\n\n\n<p>After the code has been integrated into your website, the visitors to your site will be recorded.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Integrating tracking scripts into WordPress<\/h2>\n\n\n\n<p>In WordPress, there are various ways to integrate the code into the header. Which method you use depends on your setup, your theme and your technical knowledge.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Header.php (manual integration)<\/h3>\n\n\n\n<p>You can enter the code directly into the <strong>header.php<\/strong> Insert your theme.<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 theme settings<\/h3>\n\n\n\n<p>Many modern themes offer their own fields for placing code in the header \u2013 e.g. in the theme options or in the customiser.<br>Typical for many page builder themes such as Avada, Divi or Enfold.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Hooks \/ Theme-specific integrations<\/h3>\n\n\n\n<p>Some themes and frameworks offer <strong>Hook systems<\/strong>, which allows code to be neatly inserted into the header \u2013 often without having to edit a file directly.<br>Use the documentation for your theme here.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Integration via plugins<\/h3>\n\n\n\n<p>There are numerous plugins that are specifically designed for this purpose., <strong>Tracking or header scripts<\/strong> to integrate.<br>Simply search for:<br>\u201eWordPress Header Script Plugin\u201c or \u201eWordPress Tracking Script Plugin\u201c.<\/p>\n\n\n\n<p>Especially when you <strong>E-commerce tracking<\/strong> (e.g. WooCommerce), we recommend using a plugin, as additional configurations are required here.<\/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":1,"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/helpcenter\/2089\/revisions"}],"predecessor-version":[{"id":4561,"href":"https:\/\/trackboxx.com\/en\/wp-json\/wp\/v2\/helpcenter\/2089\/revisions\/4561"}],"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}]}}