Works with your stack
Cookie consent for Autoptimize
run first, run alone
Autoptimize gathers your scripts into one optimised file and can defer it. The consent script has to run before the others, on its own.
By Optimizing Matters · autoptimize.com · WordPress.org
Is this your product? Tell us if anything here is out of date. Write to us
Autoptimize
WordPress plugin
- Tested version
- 3.1.17
- How
- Tested automatically around each Cookie Rocks version
- Last test
- 7 November 2026
- Latest version
- 3.1.17 tested
- Active installs
- 800,000+
What Autoptimize adds to your visitors’ browser
No trackers In our test of Autoptimize 3.1.17 on 7 November 2026, the plugin itself added no tracker and no cookie. What you place in your pages with it, such as a video or a map, still counts.
What matters for consent with Autoptimize
Aggregation
Combining scripts changes their order. A consent script inside the bundle runs when the bundle runs, not first.
Defer
Deferred scripts run after the page has been read. The consent script must not wait.
No page cache
Autoptimize has no page cache of its own. If you use one, it is a separate plugin, with its own page here.
Google Fonts
Autoptimize can combine Google Fonts, load them later or remove them. Only removing them, or hosting them yourself, stops the request to Google.
Lazy loading
Autoptimize can lazy load images. Frames and videos that load later still need consent when they load.
Cookie Rocks with Autoptimize
- Adds the banner’s scripts to its exclusions from delay, combining and minifying.
- Marks the consent script so it is neither moved nor delayed.
What our tests found on Autoptimize
Good to know · AutoptimizeCookie Rocks excludes its scripts from Autoptimize automatically
Cookie Rocks marks its own scripts with data-noptimize (since 0.2.0) and adds them to Autoptimize's exclusions automatically (since 0.4.0), so Autoptimize neither aggregates nor defers them.
Read in its code, 16 October 2026, Autoptimize 3.1.16.
Good to know · AutoptimizeAutoptimize defers scripts by default but leaves held scripts alone
By default it defers scripts instead of merging them. A script held as text/plain by a consent plugin is left as it is, and tags marked to be skipped are not moved.
Read in its code, 16 October 2026, Autoptimize 3.1.16.
Full detail
With its default settings, Autoptimize does not aggregate scripts: it defers them ('Do not aggregate but defer' and 'Also defer inline JS' on), turning inline scripts into <script defer src="data:text/javascript;base64,...">. Only scripts with no type or a JavaScript type are aggregated or deferred, so a script held as text/plain by a consent plugin is left as it is. Tags carrying data-noptimize, data-cfasync or data-pagespeed-no-defer, or listed through autoptimize_filter_js_exclude, are not moved.
Depends on a setting · AutoptimizeAutoptimize sets no cookie, but some options contact other servers
setting “Optimize Images” · by default: off
- No cookie or browser storage for visitors.
- Lazy loading covers images only, not iframes.
- Optimize Images (off by default) serves images from ShortPixel's CDN, which each visitor contacts.
- Combining Google Fonts keeps them on Google; only Remove Google Fonts stops those requests.
Read in its code, 16 October 2026, Autoptimize 3.1.16.
Full detail
Autoptimize sets no cookie and stores nothing in visitors' browsers (its only cookie code is an admin preference). Its lazy loading covers images only, not iframes. Optimize Images (off by default) serves the site's images from ShortPixel's CDN (sp-ao.shortpixel.ai), so each visitor's browser contacts it. Combining Google Fonts keeps them on Google's servers; only Remove Google Fonts stops those requests.
Good to know · AutoptimizeAutoptimize file merging keeps the Cookie Rocks banner working
setting “Aggregate JS-files ; Also aggregate inline JS”
With Aggregate JS-files on, Cookie Rocks scripts stay out of the merged file and trackers stay held until Accept all. With inline JS merged too, the Cookie Rocks head script stays first.
Seen in our tests, 15 October 2026, Autoptimize 3.1.16.
Full detail
With Autoptimize's Optimize JavaScript Code and Aggregate JS-files on, the Cookie Rocks scripts stay out of the aggregated file, the banner shows and the trackers are held until Accept all. With Also aggregate inline JS on as well, the Cookie Rocks head script stays in place, first in the head.
Good to know · LiteSpeed Cache, W3 Total Cache, SiteGround Optimizer, AutoptimizeCache plugins' JavaScript options keep the Cookie Rocks banner first
With LiteSpeed Cache, W3 Total Cache, SiteGround Optimizer or Autoptimize combining or delaying scripts, the banner script stays first and untouched, and trackers are held until Accept all.
Seen in our tests, 15 October 2026, LiteSpeed Cache, W3 Total Cache, SiteGround Optimizer, Autoptimize 7.9.1, 2.10.7, 7.8.4, 3.1.16.
Full detail
With JavaScript combined, minified or delayed (LiteSpeed Cache including Guest Mode and Load JS Delayed, W3 Total Cache minify in auto mode, SiteGround Optimizer combine and async, Autoptimize aggregate including inline JS), the Cookie Rocks head script stays first and untouched, its engine stays a separate file, and trackers are held until Accept all. Without a LiteSpeed web server, LiteSpeed Cache sets no cookie.
How we test it
Around each version, with its latest release
Around each Cookie Rocks version, a fresh WordPress installs its latest version from WordPress.org next to Cookie Rocks and runs the same checks. A new version joins the next run on its own.
- Autoptimize 3.1.17, tested on 7 November 2026.
- The banner shows, the trackers of the test page wait for consent and load after it, and Cookie Rocks raises no PHP error.
- Settings of the test: Default settings after activation.
- Last run: Autoptimize 3.1.17 on 7 November 2026, with WordPress 7.1.3.
Light as a pebble
11.43 kB once, 1.00 kB per page. Measured, not promised.
lighter than the font on this page*
Every kilobyte costs your visitors time and costs you Core Web Vitals. Cookie Rocks adds 11.43 kB to the first page a visitor opens, then 1.00 kB to each page after that, because its files stay in the browser cache. It calls no outside server and never shifts your layout.

11.43 kB First visit, in total
1.00 kB Each next page
7.74 kB JavaScript, first visit
3.48 kB Stylesheet, first visit
0 Requests to other servers
0 Layout shift caused
* The font on this page is Inter, compressed and cut down to the Latin alphabet. It still weighs 26.23 kB.
Optimisation
Other plugins of the same kind.
Questions
Can I use Autoptimize with a page cache plugin?
Yes. Autoptimize optimises files, a page cache stores whole pages. Each one has its own page here.
What happens after the 30-day trial?
The banner, your visitors’ choices and your proofs of consent keep working. Without a key, most settings lock, updates and support stop. Take a key at any time and everything opens again.
For Autoptimize sites
Keep Autoptimize, add consent.
run first, run alone
Every feature of the complete plugin for 30 days, no card.
- During the trial: everything, including the full settings and the scans
- After 30 days without a key: the banner, your visitors’ choices and your proofs of consent keep working
- What waits for a key: most settings, updates and support

Get your trial key
Your e-mail and your site. Your key arrives as soon as you confirm your e-mail.