The source url is recorded correctly only when an ad is clicked in FireFox. I reviewed the ad_redirect() function in ad.module and noticed the following codes -

$url = isset($_GET['u']) ? $_GET['u'] : ' ';

I'm not sure where is $_GET['u'] from. Can this be enhanced so the source url, the page hosting the ad, is retrieved accurately?

Thanks.

Comments

jeremy’s picture

Category: bug » support
Status: Active » Fixed

If $_GET['u'] is not passed in, then the code falls back to calling Drupal's referer_uri() function. This function simply uses $_SERVER['HTTP_REFERER'] which evidently is not being set by your IE browser.

How are you displaying your advertisements? If you want to set $_GET['u'], you will need to call the ad() function directly rather than displaying ads through a block, and pass in the 'url' parameter. The ad_remote module does this, for example.

dantw’s picture

Thanks for the reply.

I was displaying ads through the block created by the ad group. So based on what you said, for some reasons IE may not pick up $_SERVER['HTTP_REFERER'] and thus I should always display the ads by calling the ad() function in a PHP codes block if I want to get source url recorded?

But when I tried to show ads by calling the following in a php block
<?php print ad(43, 5, array('url' => 'http://example.com')); ?>
the source url still came out empty.

Would appreciate greatly your advice.

jeremy’s picture

Status: Fixed » Needs review

Marking as needs review.

gstokes’s picture

I appear to be having the same problem, I have the adds in a block, all image adds, when i click the add once in IE its fine but any repeat clicks go to

http://intranetdrupal/ad/redirect/175/t45?url=homepage

But in Chrome links work fine???

lrwebks’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Drupal 6 is EOL and no longer supported. Closing this as outdated for that reason. Thanks for your contribution!