Start for free – your first 3 months are freeSee the offer

Marketing and SEO

Add your own code (Hotjar, LinkedIn, TikTok and more) safely, with consent

Add scripts from other services under Custom code in the website builder, and choose whether the code may always run or only after consent to statistics or marketing.

3 min readUpdated

On this page
  1. Add the code
  2. Choose the right category
  3. What the code must not contain
  4. Frequently asked questions
  5. Is there a field for Google Ads conversions?
  6. Who is responsible for the code?
  7. Why can't I see the code working in the editor?

Many services (for example Hotjar, the LinkedIn Insight Tag and TikTok Pixel) give you a small piece of code that needs to sit on your website. In Sitewig's website builder you add it under Custom code, and you choose when the code may run.

Add the code

  1. Step 1: Copy the code from the service

    Sign in to the service and copy the installation code. Note whether it should go in <head> or before </body>.

  2. Step 2: Open Custom code

    In the editor, go to the Settings tab and find the Custom code section under Website settings.

  3. Step 3: Paste it in the right field

    Paste the code into Code in <head> or Code before </body>. Each field can hold 20 KB at most.

  4. Step 4: Choose when the code may run

    Under When may the code run? choose the category. The default is After consent (marketing).

    Website settings: Custom code with the head and body fields and the When may the code run? option
  5. Step 5: Save, publish and test

    Press Save settings, and publish the website. Open the site in a private window, press Accept all, and check with the service that it is receiving data.

Choose the right category

Three options: Always (necessary), After consent (statistics) and After consent (marketing) with examples
Only strictly necessary code may run without consent
OptionUse it forExamples
After consent (statistics)Code that measures visits and behaviourHotjar, Microsoft Clarity
After consent (marketing)Ads, audiences and conversionsLinkedIn Insight, TikTok Pixel, Google Ads
Always (necessary)Code the site can't work withoute.g. a chat widget that doesn't track

What the code must not contain

The code must not contain <html>, <head>, <body>, <template>, <base>, PHP or redirects, and all tags must be closed. Otherwise you can't save. You must also have filled in Link to cookie and privacy policy (https) under Cookie banner.

Frequently asked questions

Is there a field for Google Ads conversions?

No. Add the Google Ads tag via Google Tag Manager, or under Custom code with the After consent (marketing) option.

Who is responsible for the code?

You are. The code runs on your site, and the cookie banner lists "custom code from the website owner" as a recipient of data.

Why can't I see the code working in the editor?

Custom code is only added to the published site, never to the editor preview, and it only runs once the visitor has said yes to the chosen category. Publish, and test in a private window.

Didn't find the answer?

Reply within 1 working day · Mon–Fri 8:00–17:00 CET