Add tracking codes with Code Snippets
Add Google Tag Manager, Meta Pixel, chat widgets and verification tags to your website without editing files, on all pages or only some.
Advertising and analytics tools often ask you to "paste this code into your website". In PageShift you paste it into System → Code Snippets. Snippets run on your public website only, never inside the admin or the page editor. Only Administrators can add them.
Add a snippet
- Go to System → Code Snippets and click Add New.
- Give it a name you'll recognize (1), for example
Google Tag Manager (body part). - Paste the code exactly as the provider gives it, including the
<script>tags, into Code (2). - Under Where it runs (3), choose All pages, Only on the pages selected below or On all pages except the ones selected below. When you choose some pages, tick them in the list, or tick a whole type such as All blog posts (this includes future posts).
- Choose the Location (4) the provider asks for (see the table below).
- Leave Active (5) on, and click Create Snippet (6).
| Location | Use it for |
|---|---|
| Inside <head> | Google Analytics, Meta Pixel, verification tags (Pinterest, Google, Bing) |
| Right after <body> | The second, "noscript" part of Google Tag Manager |
| Before </body> | Chat widgets and most other scripts |
Order decides which snippet loads first when several share a location: lower numbers load first. The default, 10, is fine for most.
If the code looks broken
Before saving an active snippet, PageShift checks the code. If a <script> tag isn't closed, the code contains PHP, or it includes <html>, <head> or <body> tags, it shows what's wrong instead of saving. Copy the code again from the provider and paste it again. If you're sure it's right, tick Save anyway (I know this code is correct), or save it with Active off.
Turn a snippet on or off, edit or delete it
- Click the switch in the Active column (2 on the first picture) to turn a snippet on or off. Nothing else changes.
- Click its name to edit it, then Save Snippet.
- Point at its name and click Delete to remove it for good.
The Change log at the bottom records every change with the date and who made it, so you can trace a problem back to a change.