Resource icon

vBulletin [How To] Let Google Use Direct Links in vBa Links

Kevin

Code Monkey
Staff member
A recent conversation with a couple of people led to an interesting question: When linking to a remote site using a package like vBa Links that uses a redirect script to count the number of times that remote site was clicked on, does any Google PR from the referring page get passed to the remote site since the link was a redirect and not a direct link? :confused:

The short answer is "No, any PR from a site using a redirect script ends up passing that PR to the link of the redirect script and not to the actual remote site."

That conversation turned out to be pretty interesting for a number of reasons but the biggest reason was that we use vBadvanced Links here at vBUsers and want to pass on PR to our community member's sites. We believe in being a good neighbor.

So how do we fix it? Before we fix it, though, let's take a look at how vBa Links actually launches the remote site.

When you click on a link to view the remote site in vBa Links the remote URL is passed into a script named "showlink.php" (eg: showlink.php?l={linkID}) which in turn increments the database for the 'views' count and then it uses the vBulletin function 'print_standard_redirect' to actually redirect to the passed in URL. It is quite an efficient method of launching remote sites and the code is nice & tidy. Google, on the other hand, hates it because any PR from the vBa Links page will get associated to the showlinks.php script link and not the remote site.

OK, again, how do we fix it?

Thanks to the fact that the vBa Links code is nice & tidy and the fact that vBulletin has a hard-coded conditional to identify Google, MSN, and Yahoo we can change how vBa Links handles linking to remote sites with just template edits. Yep, no PHP code changes needed, just some template edits.

Below are the template edits needed to have Google, MSN, and Yahoo use a direct link to remote sites in vBa Links and then an explanation of what the changes do, and some other options available to you, are also given.


Modify your "adv_links_linkbit" and "adv_links_showlink" templates...

- In adv_links_showlink look for...
Code:
<td><a href="showlink.php?$session[sessionurl]l=$link[linkid]&amp;linkurl=$link[linkurl]" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$link[linkurl_display]</a></td>
... and replace it with:
Code:
<td><a href="<if condition="$show['search_engine']">$link[linkurl]<else />showlink.php?$session[sessionurl]l=$link[linkid]&amp;linkurl=$link[linkurl]</if>" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$link[linkurl_display]</a></td>
- In adv_links_linkbit look for...
Code:
<td align="$stylevar[left]" class="vbmenu_option falseclass"><a href="showlink.php?$session[sessionurl]l=$link[linkid]" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$vbphrase[view_site]</a></td>
... and replace it with:
Code:
<td align="$stylevar[left]" class="vbmenu_option falseclass"><a href="<if condition="$show['search_engine']">$link[linkurl]<else />showlink.php?$session[sessionurl]l=$link[linkid]</if>" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$vbphrase[view_site]</a></td>
The summary of what that change will do is that Google, Yahoo, and MSN will see the direct link and everybody else (including all other spiders) will see the usual redirect method.

If you really want all spiders to be affected then change $show['search_engine'] to $show['spider'] instead. Be warned that will impact performance on your site since it will have to parse the spiders.xml file everytime on the page load so it's not recommended (and, besides, the 'big 3' are Google, Yahoo, and MSN anyway. It'd be nice if Alexa was also included but that's another conversation.).

If you're worried about "Wait, will Google not like this since their bot will see something different then a human?" then change $show['search_engine'] to !$bbuserinfo['userid'] (note the exclamation point in front) and that way all non-registered guests (including humans) will see the direct method while registered visitors will see the redirect method. That actually wouldn't be so bad since that way the 'views' count would only be counted for people who are logged in to vBulletin.

When making your changes be careful since "showlink.php" is used in several different templates and several times in each of the templates mentioned above.
 
Pretty neat Kevin. I did this. I think you should pass on PR to the links in your directory. Thanks for sharing this.

Question? Do you think it would slow down performance if each link showed its PR next to it? So when a user was viewing the link details that the sites PR was there also.
 
Pretty neat Kevin. I did this. I think you should pass on PR to the links in your directory. Thanks for sharing this.
I already made the modification here at vBUsers. ;) At some of my other sites passing on PR isn't a concern but with a site like vBUsers we want to make sure that we're a good neighbor in the community.

Question? Do you think it would slow down performance if each link showed its PR next to it? So when a user was viewing the link details that the sites PR was there also.
The answer would really depend upon what method is being done to check the remote site's PR. For example, if the PR was being checked in real time every time the page was loaded then your server could get overwhelmed (eg: If you have 500 page views a day on your Links page and on that page it was displaying 10 links then your server would be doing 5,000 PR checks a day!). If you implemented a method where perhaps you stored the PR value in a local table and then checked once a day what the PR was then you'd only be doing 10 calls a day but the you would need to modify the Links code to read the new value and create a new cron job.

I think the happy medium might be that instead of having your server do the PR check to instead modify the templates to display a PR image from one of the free PR image sites. That way there really wouldn't be any additional load on your server and you could implement it most likely with just a template change. Just make sure you check with the PR image site to see what their attribution and TOS agreements are.
 
Thanks for the info Kevin. I had thought about using a free PR checking site. I will have to look into that some more. I don't know if I will do it or not but it was just an idea I had.
 
Thanks for the info Kevin. I had thought about using a free PR checking site. I will have to look into that some more. I don't know if I will do it or not but it was just an idea I had.
I'm back in town so I'm back to working the misc. stuff. :smiley:

Where were you picturing putting the PR? If you describe what you were thinking I'll put on my mental To Do list of things to ponder.
 
Oh I thought about having it next to the title of the site, but as long as it is displayed it really doesn't matter to me.
 
Back
Top