Forum Moderators: phranque

Message Too Old, No Replies

Nofollow for window.open()

         

csdude55

6:43 pm on Apr 9, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have locally sold ads on my site, and to comply with Google policies I use rel="nofollow" on the links.

But I also have onclick="window.open('clicks.php?redir=blahblahblah)", where clicks.php is a PHP script on my site that adds the click count to a database, then redirects the user using header("Location: $blah").

So the code looks like this:

<div class="ad" 
onClick="window.open('https://www.example.com/includes/clicks.php?num=8285');">
<a href="https://www.example.com/includes/clicks.php?num=8285" target="_blank" rel="nofollow">
Blah Blah Blah
</a>
</div>


A few days ago, I got a report from Google Search Console that clicks.php has a Redirect Error. So I'm guessing that, for whatever reason, they're still following the link, either through the <a href...> or the window.open(). Which could mean that I'm violating a policy, albeit inadvertently.

What do you guys suggest as the best method to ensure that they not follow these links?

not2easy

7:23 pm on Apr 9, 2018 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I've found that
Disallow: /*clicks.php?
in robots.txt works for Google in a similar situation in my experience.

csdude55

8:21 pm on Apr 9, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Cool, thanks :-)