How to block third-party scripts and cookies
Updated over a week ago

What are Third-Party Scripts and Cookies?

Third-party cookies are small pieces of data that are stored on a user's device by a website that they did not directly visit. These cookies are typically set by service partners whose scripts or tags are included on the website. They are used to track a user's browsing activity and collect information about their preferences and behavior.

For example, a chat widget on a website may store a third-party cookie on a visitor's device to identify details about their session on the site and their chat details. Similarly, Google AdWords may use a third-party cookie to track the ad campaign that a visitor came from or other relevant information.

While third-party cookies can be useful for website owners and advertisers, they can also raise privacy concerns. Some regulations, such as the General Data Protection Regulation (GDPR), require that websites block third-party cookies and other tracking mechanisms until the user gives their consent. If you have a consent banner on your website but are not blocking third-party cookies, you may not be compliant with these regulations.

Script Blocking Methods

Third-party services use scripts that you install on your website to set and read cookies from your visitors' devices. These scripts can also collect personally identifiable information (PII) about your visitors and send it to the third party's servers.

To help you comply with privacy legislation, Termly offers multiple ways to easily manage when scripts are allowed to execute on your website based on your visitors' consent preferences.

Read on below for details on the various blocking methods.

Ease of Implementation




Ongoing Maintenance




When to use

Most cases for quick setup & maintenance

If using GTM to serve third-party scripts

For granular control and/or unchanging environments

Auto Blocker (Recommended)

Termly's Auto Blocker is a tool that automatically detects all the third-party tracking mechanisms on every page when a user visits your website. It then either blocks or allows the scripts from executing based on your user's consent preferences in Termly.

You can customize how Auto Blocker categorizes scripts to suit your needs. This allows you to have more control over which scripts are blocked and which are allowed to run on your website.

Block Tags Set in Google Tag Manager (GTM)

If you use GTM to trigger third-party tags on your page, you need to properly configure your GTM environment to respond to user consent.

Manual Blocking Methods (Advanced)

To have fine control over how scripts are blocked on your website, you can manually block third-party tags and cookies with HTML. This involves individually marking up third party scripts on your website to control when they are allowed to run.

Did this answer your question?