Hi,
I have the ad module displaying ads, how they dont seem to be tracking the clicks. I've read the readme of the module and doesnt appear I need to do anything else to enable this. Any clue what I'm doing wrong? Thanks in advance.

Comments

jeremy’s picture

Status: Active » Postponed (maintainer needs more info)

What module are you using to display ads? ad_html, ad_text, ad_image, etc?

Clicks are not tracked for the ad_html module.

kahlua001’s picture

Hi, they are image ads.

kahlua001’s picture

I've narrowed down how my ads are being rendered. It uses this function in the ad.module:

function ad_link_target() {
switch (variable_get('ad_link_target', '_self')) {
case '_blank':
$target = ' onclick="window.open(this.href); return false;"';
break;
case '_parent':
$target = ' onclick="window.parent.location = this.href; return false;"';
break;
case '_top':
$target = ' onclick="window.top.location = this.href; return false;"';
break;
default:
$target = '';
break;
}
return $target;
}

I also see a method called ad_redirect which will log the click. However, in the ad_link_target() I don't see how it goes to any php page that calls the ad_redirect, it only does a JS onclick to the ad url. Any help is greatly appreciated.

jeremy’s picture

What display type are you using? Go to administer >> content >> ads >> settings and try changing the Display type -- do different display types work for you?

kahlua001’s picture

Hi Jeremy,

Thanks for helping. It was previously set to Raw, I've set it to Javascript and JQuery and clicking on the ads, still does not track the clicks. Unfortunately I cant test the iframe option as it will break the site design. Can I ask how the ad_redirect() function is called? Is it typically javascript outputted to react to the user click, that tracks it? Thanks

jeremy’s picture

I have confirmed that this works.

How are you displaying advertisements on your web page? Are you using the default blocks the module generated? Or calling ad() in your theme or elsewhere? Or are you using some other method?

If you enable one of the ad blocks and then click on the ad that is displayed in that block, is the click counted?

Redirects are handled by the ad_redirect() function in ad.module. When an advertisement is properly displayed, it will link to the redirect URL. When the ad is clicked, you are taking to the redirect link which then takes you to the proper destination URL. The only reason I can think this might not be working is if you are displaying advertisements in a non-standard/non-supported way.

kahlua001’s picture

The way it is setup is there are section defined for ads like ad_right and ad_left, in each section there is an ad block like 'ad group: Header',this block will display the # of ads and in random order. Then in the page template, the ad is being displayed like print $ad_header_left

Is this a supported way of doing this? If not, would I simply need to build my own redirect page that calls ad_redirect() to get the clicks working? Thanks for all your help.

jeremy’s picture

Sorry, I'm still not fully understanding -- how are you populating $ad_header_left?

jeremy’s picture

Status: Postponed (maintainer needs more info) » Fixed

No feedback in over two months, closing issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.