I never get stuff like that popping up randomly but only use a minimum of tweaks as over-tweaking can break my desired browsing experience.
Mods that get done to Firefox.
No Cookie notifications.
Block Popups.
DISABLE FIREFOX POCKET
about:config
Search for:- extensions.pocket.enabled
set to false
DISABLE sessionstore (stop Firefox opening previous session after a crash)
about:config
Search for:- sessionstore
browser.sessionstore.interval. Change default 15000 to 15000000.
OPTIMISE THE PLACES DATABASE (can speed up Firefox response on an old install)
about:support
Search for:- Places Database
Verify Integrity
MOVE FIREFOX NETWORK CACHE INTO RAM - Needs 2 GB OF RAM OR MORE
This will diminish the amount of disk writes and make Firefox noticeably faster.
about:config
Search for:- browser.cache.disk.enable
set to false.
Search for:- browser.cache.memory.enable
Check set to true.
browser.cache.memory.capacity
Change from -1 to 524288 (KB, which equals a maximum of 512 MB) or if you have RAM to spare, to 1048576 (KB, which equals a maximum of 1 GB).
Stop Firefox from installing and running studies.
about:preferences#privacy
Uncheck all the boxes under Firefox Data Collection and Use
Allow Solus System Settings to configure the DNS that you use.
about:preferences#privacy
Go to DNS Over HTTPS
Set 'Off - Use your default DNS Provider'
Hope this might help. It has served me well.