That depends on how the website loads the ads.
In the case of goodreads, their HTML contains javascript from the ad provider. Specifically, lines 81-145 of the HTML document returned by https://www.goodreads.com/
read:
<script>
//<![CDATA[
var gptAdSlots = gptAdSlots || [];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement("script");
gads.async = true;
gads.type = "text/javascript";
var useSSL = "https:" == document.location.protocol;
gads.src = (useSSL ? "https:" : "http:") +
"//securepubads.g.doubleclick.net/tag/js/gpt.js";
var node = document.getElementsByTagName("script")[0];
node.parentNode.insertBefore(gads, node);
})();
// page settings
//]]>
</script>
<script>
//<![CDATA[
googletag.cmd.push(function() {
googletag.pubads().setTargeting("sid", "osid.bd63050e605ccee9f21515a2dedfdaea");
googletag.pubads().setTargeting("grsession", "osid.bd63050e605ccee9f21515a2dedfdaea");
googletag.pubads().setTargeting("surface", "desktop");
googletag.pubads().setTargeting("signedin", "false");
googletag.pubads().setTargeting("gr_author", "false");
googletag.pubads().setTargeting("author", []);
googletag.pubads().enableAsyncRendering();
googletag.pubads().enableSingleRequest();
googletag.pubads().collapseEmptyDivs(true);
googletag.pubads().disableInitialLoad();
googletag.enableServices();
});
//]]>
</script>
<script>
//<![CDATA[
! function(a9, a, p, s, t, A, g) {
if (a[a9]) return;
function q(c, r) {
a[a9]._Q.push([c, r])
}
a[a9] = {
init: function() {
q("i", arguments)
},
fetchBids: function() {
q("f", arguments)
},
setDisplayBids: function() {},
_Q: []
};
A = p.createElement(s);
A.async = !0;
A.src = t;
g = p.getElementsByTagName(s)[0];
g.parentNode.insertBefore(A, g)
}("apstag", window, document, "script", "//c.amazon-adsystem.com/aax2/apstag.js");
apstag.init({
pubID: '3211', adServer: 'googletag', bidTimeout: 4e3
});
//]]>
</script>
As a consequence, the advertizer's javascript code runs in the same execution context as the website itself, and can do everything the website can, including observing all your interactions with the website.
If they had instead loaded the ads by embedding an iframe from a different origin, the advertizer's code would have run in its own execution context, and the browser would have blocked access to the surrounding website as a violation of the same origin policy.
In general, the only way to tell whether the website has isolated the advertizer's code is to inspect the code of the website.