National Review. Site Breakage: googletag.destroySlots is not a function

Description of the issue:
When I go to National Review and go into an article, then back out of it, I get an error. That error is:
googletag.destroySlots is not a function. I disabled uBO, and the issue still occured. I disabled shields, then backed out of the article using the Back button, and the issue did not appear. I went into an article, then went back to the previous page, with shields down, and I did not get the error.
Exact URL of the website in question: → Click on an article.

Screenshot of the ad as it appears in Brave

Did the issue present with default Shields settings? (yes/no)
Yes. I disabled shields and the error did not occur. I enabled shields again, and I got the error. Everything is set to default. Standard Ad Blocking, non aggressive Fingerprint blocking

Does the site function as expected when Shields are turned off?

Is there a specific Shields configuration that causes the site to break? If so, tell us that configuration. (yes/no):
No. Everything is default.

Does the site work as expected when using Chrome?

Brave version (check About Brave):
Version: 1.46.32. Nightly

Investigating, will update thread

You can fix it in the meantime by adding:

to custom filters in brave://settings/shields/filters

You can even add this one if you want Brave shields to do exactly what uBlock would do:

The reason is Brave still doesn’t seem to support redirect-rule,

Extra non-important details about it

even if I read for months it supposedly did, but I mean, I am sure, even if redirect-rule was supported, still the :priority integer has to be supported as well, in order for Brave to properly read many redirect-rule filters from uBlock lists

so Brave is ignoring the uBlock Privacy filter that usually deals okay with this kind of stuff and gpt.js is only getting blocked by Easylist/EasyPrivacy and that’s the issue, so you need to force the $redirect on it.

1 Like

Thank you for the fix! It seems to be working now.

I notice that:

  1. uBlock filter lists don’t use $redirect-rule in this case but plain $redirect and the priority :5 and the uBlock logger says they use redirect-rule because of whatever reason but I always thought that was the problem.

  2. I noticed Brave unbreak list already took care of removing the priority integer here which would make the $redirect rules compatible with Brave, and well, it looks exactly like what I told the OP to add as a custom rule (minus the domain) but it seems like Brave adblocker is not using them them even if they are there in a default list.

So I guess that should really be checked and see why Brave is not using those $redirect rules which were added so they would work in Brave as they do in uBlock lists with the priority integer.

But for example most don’t work: gpt.js, gtm.js, analytics.js etc, but something like the beacon.js does work, even if it is the exact same case than the others, which can be easily seen in a website like where only beacon.js appears in the list of sources with the uBlock redirected script and analytics and gtm, they are only getting blocked, but you add the same rules brave-unbreak has to custom filters and now they work as expected, sometimes they need $important for them to work, so I added that as well, but Zillow doesn’t need that.

Anyway, I guess I will keep overriding and fixing these things myself until it gets fixed, but I wanted to expand the information because I noticed that today.

So I am now having a similar issue. Same website. Same repro steps. But I get a flash of “googletag is not defined.” But it shows for a split second and then goes away and I can browse the website as normal. Still a bit odd behavior.

When you to national review and go to DevTools → Sources do you see / / gpt.js or gtm.js?id= in the list (if you aren’t grouping by folder).

It is still working on my side, with the rules I told you to add as customs. I even turned my fixes lists to make sure nothing was like broken or something in the rules I told you to add. The only time I get the message is if gpt.js gets blocked (doesn’t appear in sources list) and not redirected (appears in source list with a text:

uBlock Origin - a browser extension to block requests.
Copyright (C) 2019-present Raymond Hill


I do not see any of those sources in the dev tools. I mean it’s still sorta working. The “googletag is not defined” page pops up but then goes away without me doing anything. Just sorta flashes and then disappears when I click the back button.

That shouldn’t be the case, that’s why the error happens, they should appear in Sources and have the uBlock Origin text since they are the same resources uBlock uses, which means they are getting redirected.

Maybe you can show a screenshot of the custom filter lists to know if there is a mistake in them or something in the filters I told you to add?

But there is something you can do, apparently the rules work if you load the brave-unbreak list as custom list

I was testing that today for a new update in Nigthly, and decided to use it a as a custom list to see if it worked and it does.

The only issue is custom lists currently don’t auto-update, but since you only need them for the $redirect filters, then in theory doesn’t matter.
And I don’t know if it is the best way of doing things though, since you are loading two lists with the same rules, but it works, for whatever reason the rules are ignored in the default list but not as custom.

So you can try that as well. But it works great, if I disable the rules with the $redirect it shows the problem, enable them and it works fine.

The custom filters that I have enabled in the filter list are:
EasyList-Cookie List, Fanboy Annoyances List, Fanboy Social List and uBlock Annoyances List.
Screenshot from 2022-10-21 11-45-31

I have added the unBreak URL. The issue still occurs.
Here is a screenshot of what I see in the DevTools when I get the popup

I don’t know what to tell you, seems fine on your side, but I even tested it in an old Stable Brave version v1.44.101 which is standalone so it doesn’t get updated, and it works fine.

This what what I mean should look like in the sources panel:

Do you have some script like no-script or another adblocker? that could be conflicting with it?

I mean, like if source panel looks like in my screenshot and even uBlock throws the error, then the only alternative would be to whitelist the script:

Unless you don’t want to test it anymore and just whitelist it so it doesn’t bother you anymore.

So mine looks similar to yours. Except that I only have
I do not have googletagservices under sources.

I do not have any other ad blocker extensions or similar installed. Just Brave, my PW Manager, and two others. But none adblocker related. I am on nightly version 1.47.6

Yeah that’s the one that is useless to redirect, because it is the gpt that causes the whole mess.

What if you replace the first rule by this:


That’s what I use in my redirect custom list, just ignore the ‘domain’ and push it everywhere and even with important so it gets applied to most (so I don’t asssume all) whitelisted gpt.js if any.

Also, I would suggest clicking the save button 300 million times to make sure they apply and when you refresh use ctrl+F5 or ctrl+shift+R so it hard reloads the browser

I replaced the first rule with what you put, pressed save a bunch of times, and then reloaded the browser using both methods. Still get “googletag is undefined” when going into an article and then pressing the back button to go back a page.

Well, I don’t know what to say, I am confused.
I am even using latest Nightly v1.47.9 which finally added support for $redirect-rule.

So I even added ||$script, and it works too.

So it is weird it is just not working at all on your side, only thing I see is that it has an old Nightly, and unless you want to test updating your nightly (and even using the redirect-rule because it is cool to use the latest feature), then I don’t know what to suggest, but the whitelist the script.

If it doesn’t appear in sources with uBlock text on it which mean it got redirected, then it will always throw the error I think.

you might get a little tracked if you whitelist the script but oh well, to be honest, I really don’t know/care what those google tag scripts do lol I just assume they will track you if they come from google.

The weird thing is it even worked in a month old stable build, and it works in even latest Nightly with the redirect-rule filter which is the latest newest coolest feature.

BTW, if you want to know the difference between redirect and redirect-rule:


The difference is
$redirect = block and redirect
$redirect-rule = only applies redirection to an already blocked rule

Which is great since Easylist can block something and uBlock only needs to say, ok, you are blocked, now I will just apply the redirect part of it, which avoids conflicts and all that.

I just updated to Nightly v1.47.10 (I am on Linux) and I included the new filter that you put, and I still get the same issue. I also do not see in the sources tab in devtools. So I am at a loss to be honest. Not sure what else could be the issue.

Ok, last message. I deleted the others ones because they don’t matter.

The reason you are having problems is because of your DNS server. I have the same problem now because I use Adguard public DNS on my router, but I don’t use it in my computer, now I use the router’s DNS server IP, I get the same exact problem as you.
I figure it out with Android when I realized I had Adguard on my phone but on my computer I was using my ISPs ones, and when I changed Android ones everything was fixed, when I changed my computer ones to my router’s one, then it failed like in your case.

The thing is the script will get blocked no matter what, so it will throw the error no matter what, since it will override the Brave’s adblocker.

You can switch Brave’s DNS sever in brave://settings/security and use something that doesn’t block trackers, and let Brave do it, which will do a better job anyway, so you don’t need it in a browser and only in your computer and other devices like android for apps and all that to remove ads and all that from apps.

But yeah, nothing you can’t do, that’s the problem with DNS adblockers, because they do it by domain, so they can’t be selective like browsers and how it can inspect every connection element and now adblockers can do so many nice things like redirection and scriptlet injection, so no need for DNS adblocker in Brave.

Take care! Hope you don’t have more problems.

Ahh ****. You are right. I forgot that I had AdBlocking enabled on my VPN. I’m such a dummy lol. Forgot about Mullvad being enabled and having AdBlocking enabled on it. It’s all good now! Thank you. Sorry for the late reply. Just got home from work.

Edit: Now my “sources” tab on NR looks like what you showed yours as looking like. It all makes sense now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.