In the first case, you can scan your Mac with CleanMyMac or some antivirus. In the second case, we recommend using AdGuard for Mac, that will block any unwanted pop-ups and redirects in your browsers. How Stags.bluekai.com infected your Mac. Nov 07, 2018  AdGuard for Safari is based on the Safari native content blocking API, which makes it lightning fast.

From Insoft:
Adguard is the world's first standalone ad blocker for Mac OS X. It is an ultimate program has all the features to ensure more efficient and comfortable use of the Internet. Ad blocking, phishing and malware protection, and protection of your personal data in the Internet. Macs and Apple laptops are quite safe to use without antivirus by default, and security software is just a good addition to the overall protection of devices. But when it comes to ad blockers, Macs experience real problems. Already existing solutions were browser extensions that did not consider specifics of the OS. They were implemented as hacks: as an InputManager and/or ApplicationEnhancer. That greatly influenced the stability of work in Safari browser that is the most popular browser among Mac users. These ad blocking extensions failed to do their work properly, and especially video ads were an issue. New Adguard does not have any problems with ad filtering - all banners, flash animation, text and video ads are completely removed on Mac. It works perfectly with all browsers as it was developed specially for use on OS X.
Mac

Adguard For Mac Manual Software

What do you need to know about free software?