DocsMonitoringCode snippets

Code snippets. Is the tracking code still there?

A snippet is a piece of text Search Sentinel looks for in the page's HTML on every check. You hear about it when it goes missing, or comes back.

On this page

How matching works

  • Matching is an exact, case-sensitive text match on the raw HTML the server returns.
  • There are no regular expressions or wildcards. Use a distinctive, literal piece of the code.
  • JavaScript is not run. Code that a tag manager injects in the browser is not in the HTML and will not be found; look for the tag manager's own code instead.
  • A change is logged when a snippet goes from found to not found, or from not found to found. Each change reads, for example, "Google Analytics" is now missing.

Good patterns

To checkPattern
GA4 taggtag('config', 'G-ABC1234567'
Google Tag Manager containerGTM-K7Q2XQ
Meta pixelconnect.facebook.net/en_US/fbevents.js
A consent scriptits script file name, like cookiebanner.min.js
A link that must stayhref="/returns-policy/"
Staging leftoversstaging.example.com (you are alerted when it appears)

Tip

Copy the pattern from the page source exactly, including quotes. A difference of one character, or single versus double quotes, means not found.

Adding snippets to one URL

  1. Open the URL and choose Snippet tracking.
  2. Click Add Snippet, enter a Label like "Google Analytics" and the Code Pattern to Search.
  3. Save. The status shows Pending Check until the next check, then Found or Not Found.

Each snippet shows when it was last checked and last found, or Never detected. Click the status to open the page's HTML with the snippet highlighted and Scroll to code snippet. Turn a snippet off with its active toggle, or delete it.

Adding snippets to many URLs

  • While adding URLs. Fill in Code Snippets to Track (Optional) in the Add URLs tab. In bulk mode the snippets apply to every URL you add.
  • Bulk add. In the project Settings, Bulk Add Code Snippets adds one label and pattern to the URLs you select (all active URLs by default).

Limits and alerts

Snippets are part of the normal check and use no extra checks. The number of active snippets depends on your plan: 3 on the trial, 20 on Small, 100 on Medium, 250 on Large, 500 on Agency and unlimited on Enterprise.

Alerts for snippets are sent when Code Snippets is on in the URL's alert settings.