Skip to content

Commit 6bfe257

Browse files
committed
cookie banners
1 parent 404206c commit 6bfe257

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

_includes/additional_parameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
| **device_scale** | `Double` | Controls the image resolution by adjusting the pixel ratio. Minimum: `1`, Maximum: `3`. Higher values increase image quality and file size. For example, `2` will double the resolution. [Learn more](/parameters/device_scale/). |
77
| **render_when_ready** | `Boolean` | Set to true to control when the image is generated. Call `ScreenshotReady()` from JavaScript to generate the image. [Learn more](/parameters/render_when_ready/). |
88
| **full_screen** | `Boolean` | When set to true, the API will generate an image of the entire height of the page. |
9+
| **block_consent_banners** | `Boolean` | When set to `true`, automatically blocks cookie consent banners and popups on websites. Most useful for URL screenshots. |
910
| **viewport_width** | `Integer` | Set the width of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either. |
1011
| **viewport_height** | `Integer` | Set the height of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either. |

changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ Always improving. Updates to HTML/CSS to Image are posted here.
1616

1717
If you have feature requests, please send them to us: [email protected].
1818

19+
### Automatic cookie consent banner blocking
20+
June 18, 2025
21+
{: .text-delta}
22+
23+
We've added a new `block_consent_banners` parameter that automatically blocks cookie consent popups and banners on websites. When set to `true`, the API will detect and hide common consent frameworks like OneTrust, Cookiebot, Quantcast Choice, TrustArc, and many others.
24+
25+
This feature is especially useful for URL screenshots where cookie banners can interfere with the desired content. Instead of manually writing CSS to hide specific banners, you can now use this single parameter to handle most cases automatically.
26+
27+
The automatic blocking is maintained and updated regularly to support new consent frameworks as they emerge. For custom implementations not covered by the automatic blocking, you can still use the existing CSS injection method.
28+
29+
<hr>
30+
1931
### Single-Request Image Generation endpoint
2032
June 15, 2025
2133
{: .text-delta}

getting-started/url-to-image.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ To learn about CSS Selectors, we recommend [this article](https://www.w3schools.
7575

7676
<hr>
7777

78+
## Blocking cookie consent banners
79+
80+
Many websites display cookie consent popups that can interfere with your screenshots. Use the `block_consent_banners` parameter to automatically hide these:
81+
82+
```bash
83+
curl -X POST https://hcti.io/v1/image -u 'UserID:APIKey' \
84+
--data-urlencode url="https://example.com" \
85+
--data block_consent_banners=true
86+
```
87+
88+
This automatically detects and blocks common consent frameworks like OneTrust, Cookiebot, and others. For more advanced cases, see our [complete guide to blocking cookie banners](/guides/blocking-cookie-banners/).
89+
90+
<hr>
91+
7892
## Pages requiring login or sign-in
7993

8094
Our API does not support pages that require login. The URL must be publicly accessible for us to generate an image of it.

guides/blocking-cookie-banners.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,34 @@ Learn how to block cookie banners with taking screenshots
1818

1919
## How it works
2020

21-
The easiest way to hide cookie banners in your screenshots is by injecting CSS into your image to hide them.
21+
The easiest way to hide cookie banners in your screenshots is by using the `block_consent_banners` parameter.
22+
23+
When set to `true`, the API will automatically detect and block common cookie consent banners and popups on websites. This is the recommended approach for most use cases.
24+
25+
## Automatic Cookie Banner Blocking
26+
27+
Simply add `block_consent_banners: true` to your API request:
28+
29+
```json
30+
{
31+
"url": "https://example.com",
32+
"block_consent_banners": true
33+
}
34+
```
35+
36+
This automatically handles the most common cookie consent frameworks including:
37+
- OneTrust
38+
- Cookiebot
39+
- Quantcast Choice
40+
- TrustArc
41+
- Osano
42+
- And many others
43+
44+
{% include hint.md title="Recommended Method" text="Using block_consent_banners is the easiest and most reliable way to hide cookie popups. It's maintained and updated regularly to handle new consent frameworks." %}
45+
46+
## Manual CSS Injection (Advanced)
47+
48+
For custom cookie banners not covered by the automatic blocking, you can still use CSS injection.
2249

2350
Any CSS passed via the `css` param when generating a URL image will get injected into the page.
2451

0 commit comments

Comments
 (0)