Skip to content
A
For administrators
Running the administration — content, users, e-shop, invoicing and settings
System / Custom code

Custom code#

Inserting your own CSS, JavaScript, or a third-party snippet into the pages of the site — without access to the files on the server.

Find it under Nastavení → Vlastní kód (the Nastavení link at the bottom of the left column).

It is not a replacement for editing the template

The inserted code is neither checked nor adjusted — it runs exactly as you write it. A mistake in the CSS breaks the look of the whole site; a mistake in the JavaScript breaks its features. Permanent changes to the design belong in the template; this is for what is needed right now or just once: a measurement tag, a small style fix, a snippet from a supplier.

Whoever gets in here controls the site

JavaScript inserted into a page sees everything the visitor does on it — including what they type into forms and including signing in. The screen therefore has its own permission, Vlastní kód, granted separately under Roles and privileges. Access to Settings does not grant it automatically.

What you fill in for each piece of code#

Field What it is for
Popis for you — so that in a year you know what it is and why it is there
Typ CSS / JavaScript / HTML — see below
Umístění where in the page the code goes
Souhlas s cookies should it wait for the visitor's consent?
Kód the contents
Pořadí the lower the number, the earlier it is inserted
Aktivní unticking removes it from the pages but keeps it stored

Deactivating beats deleting

When something is wrong, untick Aktivní and save. The code stays, so you can come back to it — and finding the culprit is one click.

The type decides how the code is inserted#

Type What you write What appears in the page
CSS the rules only, .class { color } <style>…</style>
JavaScript the code only, without tags <script>…</script>
HTML the whole snippet including tags inserted exactly as is

Do not write the tags for CSS and JS

The wrapping <style> or <script> is added by the system. Writing it as well produces <style><style> and the browser gets lost in it.

The HTML type is for third-party snippets

Code from Google, Facebook, or a chat tool usually brings its own tags including <script src="…">. That belongs here — paste it unchanged.

Placement#

Option Where it goes When to use it
Hlavička into <head> styles and libraries that must load before the content
Začátek stránky right after <body> whatever explicitly requires it — typically the <noscript> part of Tag Manager
Konec stránky before </body> scripts that should wait until the page is ready

When in doubt, use the end of the page

A script in the head slows rendering down — the browser has to download and run it before it shows anything. At the end of the page it costs no speed.

Does your code store cookies or send data somewhere? Pick a category. The code will then run only once the visitor allows that category on the cookie bar — until then it sits in the page, inert.

Exactly the categories from the cookie bar are offered

The list is not a separate setting of this screen — it is the same list the Cookie settings modal is built from, minus Necessary (always granted, so it would not differ from "always run"). When a new category is added to the site, it appears here on its own. Adding one is a developer change in the configuration, not an administrator setting.

Without a category the code always runs

The "always run" option means the cookie bar has no effect on your code. For a measurement script or an advertising pixel that means the site measures even visitors who declined — and does not match what the bar promised them.

Consent cannot be enforced for the HTML type

A foreign snippet brings its own tags, so there is nothing to reconfigure on them. The form therefore refuses that combination. The fix: take just the inside of the snippet's <script> and insert it as the JavaScript type — there the category works.

CSS can load fonts and images from elsewhere (@import, url(https://…)); a script can load further scripts. All of it is downloaded by the visitor's browser, not by your server.

The foreign server learns about every visitor

It receives their IP address and the address of the page they opened. For your cookie and personal-data policy that is the same as putting a tracker there. We do not forbid it — just know about it.

Procedure: insert a measurement tag#

  1. Open Nastavení at the bottom of the left column and switch to the Vlastní kód tab.
  2. Click Přidat kód.
  3. In Popis write what it is (for example Traffic measurement).
  4. Leave Typ on JavaScript and paste only what sits between <script> and </script>.
  5. Set Umístění to Konec stránky.
  6. In Souhlas s cookies pick Analytické.
  7. Press Uložit and open the site — check in the browser that the code runs only after cookies are accepted.

Code for a single page#

A script that belongs on one page only (order confirmation, event sign-up) is not entered here but under Základy → Stránky on that page. The section is called Skripty stránky and looks the same.

Option What it does
Přidat za celowebové the page scripts render after the ones that apply everywhere
Nahradit celowebové on this page only the page scripts run

CSS for a single page is not entered there

A page offers JavaScript and HTML only. Site-wide CSS is always rendered — even in Nahradit mode — otherwise the page would lose its design with nothing to explain why. A different look for one page is handled by its HTML class and a rule in the site-wide CSS.

Use Nahradit sparingly

It also switches off the measurement that otherwise runs everywhere. Most of the time you want Přidat za celowebové.

When the code does not show up#

  1. Is Aktivní ticked?
  2. Is it waiting for a cookie consent you have not given in your browser?
  3. Does the placement match — are you looking for an end-of-page script in the head?
  4. For code limited to one page: are you looking at the right page?

The change may not show up immediately

The system remembers the settings. If you saved and the site still shows the old state, ask your administrator to clear the cache.