Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

Interstitial Ads and Cloaked Aff Links

Joined
Sep 17, 2012
Posts
376
Reaction score
62
Thought this might be a good place to ask this.. if you have a site that mixes google auto ads and affiliate content and you cloak the links through a sub folder (eg: /go/link/) then you end up getting an interstitial ad on the link, which obviously isn't ideal from a conversion perspective.

Eg: It goes:

Page -- click --> Interstitial ad -- dismiss --> Aff link

Is there any way to tell google to not show an interstitial ad on a specific link (or even for clicks to a specific sub folder would do it).
 
Couldn't you wrap the Google ads script tag in a conditional tag - assuming you are using server side code like PHP?

Alternatively, couldn't this be handled using Google Tag Manager?
 
Yeah you can exclude it from the page no problem, but we want the ads to run on the rest of the page... just not when that one specific link is clicked - it's a pretty big page and just has an aff unit after the intro for a specific product.
 
That's just talking about a nested subfolder isn't it? Eg: /first-directory/second-directory/

There's no ad code on the redirect URL so I'm assuming it must be triggered by the code on the page that the link is on. So blocking the /go/ folder wouldn't work as the relevant ads are running on the /page-with-link/.

Ie: The interstitial ads are actually controlled by ad code on the page you're leaving, not the page you're going to. If that makes sense.
 
It's just using auto ads on every page - so just the same single bit of code and we've not mucked about with anything.

That link did have a bit of useful info:

Some links on a page may be considered ineligible to show interstitial ads. Interstitial ads won’t be shown when a user clicks an ineligible link, for example, links to URLs without HTTP/HTTPS and links that open a new window.

So opening it in a new window would probably do the job.... except then we'd have to battle the ad blockers potentially not showing the link.

It's interesting that no one else seems to have this issue before (or have realised it's there) because searches bring up very little info on the subject.
 
@baldidiot
I know this is old but did you resolve it ??
Couldn't you simply do something like the following :
There are a few ways to do this...
If you're using PHP the easiest way would to be to assign a name to the link ID
you dont want google ads to show on ..
like
<a href="external-link-1" id="dontshow">

then wrap the google ad code inside a php function

Or simply use jQuery to remove any of the code inserted on that specific a tag
 
@baldidiot
I know this is old but did you resolve it ??
Couldn't you simply do something like the following :
There are a few ways to do this...
If you're using PHP the easiest way would to be to assign a name to the link ID
you dont want google ads to show on ..
like
<a href="external-link-1" id="dontshow">

then wrap the google ad code inside a php function

Or simply use jQuery to remove any of the code inserted on that specific a tag
He's talking about auto ads, where you include one bit of code and it'll do all of the ad implementation for you (placement of ads, vignette ads, interstitial ads, sticky ads and even shopping links and all sorts). You can add exclusions for entire pages from within Adsense, but I'm not aware of a client side solution for this after searching the internet.

I suspect that they won't show an interstitial ad if you add an on-click handler to a link and use JavaScript to redirect to another page. It'll probably just be for pure anchor tags... otherwise they would risk showing them at odd times. Just a hunch.
 
Last edited:
Could still check the source using jquery once page has loaded for relevant code inserted by google
There is a way to do it though..
Can someone point me to a site that does use google intersitals so I can have a look at their JS to provide a definitive answer ?
Not really played around with auto ads much but there will be a way to do it
even if its a case of checking the referring link thats clicked and hiding the element id.
Need to have a look at some code though but its achieveable
 
Looking at the initial post it seems could simply check the current URL using PHP ..
and then where you add the google script tag
simply put this inside the <head></head> or wherever you call it from on the page
<?php
if($_SERVER['PHP_SELF'] !== 'this-link')
{
Goggle script tag here
}
?>

could even create an array of links and use

<?php
$links = array("link-1","link-2","link-3");
if(!in_array($_SERVER['PHP_SELF'],$links))
{
Goggle script tag here
}
?>
 
T
Looking at the initial post it seems could simply check the current URL using PHP ..
and then where you add the google script tag
simply put this inside the <head></head> or wherever you call it from on the page
<?php
if($_SERVER['PHP_SELF'] !== 'this-link')
{
Goggle script tag here
}
?>

could even create an array of links and use

<?php
$links = array("link-1","link-2","link-3");
if(!in_array($_SERVER['PHP_SELF'],$links))
{
Goggle script tag here
}
?>

Maybe something like this?

Code:
<script>
  // Get the current URL path
  var currentPath = window.location.pathname;

  // Define an array of links or subfolders where you don't want interstitial ads
  var excludedLinks = ["/go/link1/", "/go/link2/", "/go/link3/"]; // Add your links here

  // Check if the currentPath matches any excluded link
  if (excludedLinks.some(link => currentPath.includes(link))) {
   // Do not load the interstitial ad code
  } else {
   // Load the Google AdSense code as usual
   // Replace 'your_ad_unit_id' with your actual AdSense ad unit ID
   (adsbygoogle = window.adsbygoogle || []).push({
     google_ad_client: "ca-pub-XXXXXXXXXXXX",
     enable_page_level_ads: true
   });
  }
</script>
 
Yep...
Checking with JS would make more sense as the page has already loaded
 
I assumed that the requirements were to show Google ads, but just not have the interstitial ads triggered when essentially leaving the website (via proxy link). I might be wrong though.

If the question is how to I prevent Google Adsense ads from appearing on a particular page then you just don't include the adsense code on the page and Ben's code looks perfectly valid. I would always prefer to do this via the server response than on the client side, but needs must if you don't have the possibility to do so.
 
Yeah I'd go with Ben's personally and you could also do an on click function as well to test any clicks on all A tags

$("a").click(function () {
var excludedLinks = ["/go/link1/", "/go/link2/", "/go/link3/"];
var addressValue = $(this).attr("href");
if (excludedLinks.some(link => addressValue)) {
// Do not load the interstitial ad code​
} else {
// Load the Google AdSense code as usual
// Replace 'your_ad_unit_id' with your actual AdSense ad unit ID
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-XXXXXXXXXXXX",
enable_page_level_ads: true
});
}​
});
 
Yeah I'd go with Ben's personally and you could also do an on click function as well to test any clicks on all A tags

$("a").click(function () {
var excludedLinks = ["/go/link1/", "/go/link2/", "/go/link3/"];
var addressValue = $(this).attr("href");
if (excludedLinks.some(link => addressValue)) {
// Do not load the interstitial ad code​
} else {
// Load the Google AdSense code as usual
// Replace 'your_ad_unit_id' with your actual AdSense ad unit ID
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-XXXXXXXXXXXX",
enable_page_level_ads: true
});
}​
});
That would load the Adsense code after a click on any anchor tag, which I don't think is what is desired. Cause this would prevent any ads from being displayed and then it would display them after clicking a link, which is the last time you want ads to be loaded, cause they're already leaving the current page.

If the ad code was just for interstitial ads then I might be inclined to agree, but it's all ads (interstitial and ad placements) or nothing with that code.
 
Yeah that was just something I knocked up quickly last night so it wont be accurate but its enough to give a rough idea.

If its a static link that you want the ads not to show on simply assign the a tag an id value
and replace $("a").click(function () {
with
$("#excludedID").click(function () {

Either way would be trial and error to get the desired effect and all we can do is speculate right nowregarding the code because we don't know the code structure at the moment etc

That would load the Adsense code after a click on any anchor tag, which I don't think is what is desired. Cause this would prevent any ads from being displayed and then it would display them after clicking a link, which is the last time you want ads to be loaded, cause they're already leaving the current page.

If the ad code was just for interstitial ads then I might be inclined to agree, but it's all ads (interstitial and ad placements) or nothing with that code.
 
Really? Resurrecting a 2 year old thread?

These code snippets make no sense.

Both of your snippets prevent Adsense from being displayed on pageload, or adsense should only load when a user clicks a link that isn't deemed as "excluded".
  1. The version where a user clicks a link is wrong because the Adsense snippet won't be loaded until a user clicks a non excluded link.
  2. The version checking for the existence of an excluded link on the page, and only loading the Adsense snippet if that link doesn't exist is also incorrect.
Both versions mean standard ad placements won't be displayed on page load, which is silly.

The OP still wants Adsense to be displayed on every page, but is asking that when a specific link is clicked, interstitials aren't shown.

This means that when a link containing `[href*="/go/link"]` is clicked, it's at that point that the OP wants something to happen to prevent a specific ad type from displaying.

Removing the adsense snippet from the DOM is an option, but it has the potential to cause other issues such as:
  1. You don't know if there are modals on the page that should also show ads
  2. If the page has infinite scrolling you wouldn't want to remove the adsense snippet, as this would prevent more ads from loading.
You'd also need to test there are no adverse effects, and ensure ad clicks are still tracked if the script has been removed from the DOM.
 
Last edited:
I refer back to my idea of adding an on click script and using JS to redirect the user. I don't think Google Adsense will trigger an interstitial on a Javascript triggered navigation.

jQuery is unnecessary nowadays imho. Modern browsers have everything built in that you need :).
 

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Featured Services

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel
Acorn Domains Merch
MariaBuy Marketplace

New Threads

Domain Forum Friends

Other domain-related communities we can recommend.

Our Mods' Businesses

Perfect
Service
Laskos
URL Shortener
*the exceptional businesses of our esteemed moderators
Top Bottom