I am having trouble properly using channels with the "specific URLs" field. As soon as I limit the channel to any of a combination of urls (full paths, local, wildcards or not), it no longer functions. Removing an ad from a channel will result in it displaying immediately, and adding it back to the channel will hide it, even if the path of the current page is included in the channel URLs.

Comments

jameshallam’s picture

If it's helpful, here is my debug output:

ad_dir: '/usr/webserver/content/drupal/docs/sites/all/modules/ad'
debug: '2'
adcache: 'none'
nids: ''
tids: '165'
hostid: ''
url: ''
quantity: '1'
aid: '0'
ad_display: 'javascript'
Drupal bootstrap '0'.
Root drupal directory detected as '/usr/webserver/content/drupal/docs'.

/usr/webserver/content/drupal/docs/sites/all/modules/ad/serve.php: // $Id: serve.php,v 1.1.2.2.2.1.2.1 2009/02/23 22:39:02 jeremy Exp $
/usr/webserver/content/drupal/docs/sites/all/modules/ad/adserve.inc: // $Id: adserve.inc,v 1.1.2.31.2.8.2.1 2009/02/23 22:39:02 jeremy Exp $
/usr/webserver/content/drupal/docs/sites/all/modules/ad/adcache.inc:
/usr/webserver/content/drupal/docs/sites/all/modules/ad/ad.module: // $Id: ad.module,v 1.2.2.29.2.83.2.16.2.7 2009/03/05 22:52:11 jeremy Exp $
/usr/webserver/content/drupal/docs/sites/all/modules/ad/ad.install: // $Id: ad.install,v 1.2.2.4.2.27.2.7.2.1 2009/02/23 22:39:02 jeremy Exp $

adserve_cache function(get_ad_ids)
Cache function 'ad_cache_none_get_ad_ids' does not exist.
Invoking cache function 'adserve_cache_get_ad_ids'.
Entering default adserve_display.
adserve_cache function(open)
Cache function 'ad_cache_none_open' does not exist.
Invoking cache function 'adserve_cache_open'.
Drupal bootstrap '8'.
Hostid: 'none'.
adserve_invoke_hook hook(init) action(first)
adserve_cache function(hook)
Cache function 'ad_cache_none_hook' does not exist.
Invoking cache function 'adserve_cache_hook'.
adserve_cache function(get_cache)
Cache function 'ad_cache_none_get_cache' does not exist.
Invoking cache function 'adserve_cache_get_cache'.
adserve_cache function(build_hooks)
Cache function 'ad_cache_none_build_hooks' does not exist.
Invoking cache function 'adserve_cache_build_hooks'.
Did not find hook 'init'.
Function 'adserve_hook_init' does not exist.
adserve_cache function(id)
Cache function 'ad_cache_none_id' does not exist.
Invoking cache function 'adserve_cache_id'.
Unsupported type 'host'.
Searching tids: 165
adserve_cache function(id)
Invoking cache function 'adserve_cache_id'.
Total ads: '0'.
Already displayed: 0
adserve_cache function(validate)
Cache function 'ad_cache_none_validate' does not exist.
Invoking cache function 'adserve_cache_validate'.
Validated ads: '0'.
adserve_invoke_hook hook(filter) action(intersect)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Invoking hook 'filter'.
Including file: '/usr/webserver/content/drupal/docs/sites/all/modules/ad/channel/ad_channel.inc'.
Invoking 'ad_channel_cache_filter'.
ad_channel_cache: adserve_cache_filter
adserve_cache function(get_cache)
Invoking cache function 'adserve_cache_get_cache'.
adserve_cache function(get_cache)
Invoking cache function 'adserve_cache_get_cache'.
ad_channel_cache: returning non-premiere advertisements
Filtered ads: '0'.
adserve_invoke_hook hook(weight) action(first)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'weight'.
Invoking 'adserve_hook_weight'.
Weighted ads: '0'.
adserve_invoke_hook hook(select) action(first)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'select'.
Invoking 'adserve_hook_select'.
No more advertisements available.
Selected ads: '0'.
adserve_cache function(display)
Cache function 'ad_cache_none_display' does not exist.
Invoking cache function 'adserve_cache_display'.
adserve_cache function(increment)
Cache function 'ad_cache_none_increment' does not exist.
Invoking cache function 'adserve_cache_increment'.
adserve_increment action(count) aid() hostid()
Drupal bootstrap '8'.
adserve_invoke_hook hook(increment_extra) action(merge)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'increment_extra'.
Function 'adserve_hook_increment_extra' does not exist.
adserve_increment extra()
adserve_cache function(close)
Cache function 'ad_cache_none_close' does not exist.
Cache function 'adserve_cache_close' does not exist.
adserve_invoke_hook hook(init_text) action(append)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'init_text'.
Function 'adserve_hook_init_text' does not exist.
adserve_invoke_hook hook(exit_text) action(append)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'exit_text'.
Function 'adserve_hook_exit_text' does not exist.
document.write('\x3c!-- No active ads were found in t165 --\x3e');

Jeremy’s picture

Status: Active » Postponed (maintainer needs more info)

Your debug output shows that there are now active advertisements in the ad group with a tid of 165. This is what the message at the end is also telling you, "No active ads were found in t165".

How are you adding an advertisement to a channel? How are you removing it from a channel? Can you also provide debug when it works?

jameshallam’s picture

Thanks Jeremy. I configured a couple of groups and a couple of channels, then added the ads to the channels from the ad item edit screen, using the UI.

With no ads assigned to channels, they currently display fine, just the same set displays everywhere on the site. Here is the debug from a currently working ad (thanks!):

ad_dir: '/usr/webserver/content/drupal/docs/sites/all/modules/ad'
debug: '2'
adcache: 'none'
nids: ''
tids: '163'
hostid: ''
url: ''
quantity: '1'
aid: '0'
ad_display: 'javascript'
Drupal bootstrap '0'.
Root drupal directory detected as '/usr/webserver/content/drupal/docs'.

/usr/webserver/content/drupal/docs/sites/all/modules/ad/serve.php: // $Id: serve.php,v 1.1.2.2.2.1.2.1 2009/02/23 22:39:02 jeremy Exp $
/usr/webserver/content/drupal/docs/sites/all/modules/ad/adserve.inc: // $Id: adserve.inc,v 1.1.2.31.2.8.2.1 2009/02/23 22:39:02 jeremy Exp $
/usr/webserver/content/drupal/docs/sites/all/modules/ad/adcache.inc:
/usr/webserver/content/drupal/docs/sites/all/modules/ad/ad.module: // $Id: ad.module,v 1.2.2.29.2.83.2.16.2.7 2009/03/05 22:52:11 jeremy Exp $
/usr/webserver/content/drupal/docs/sites/all/modules/ad/ad.install: // $Id: ad.install,v 1.2.2.4.2.27.2.7.2.1 2009/02/23 22:39:02 jeremy Exp $

adserve_cache function(get_ad_ids)
Cache function 'ad_cache_none_get_ad_ids' does not exist.
Invoking cache function 'adserve_cache_get_ad_ids'.
Entering default adserve_display.
adserve_cache function(open)
Cache function 'ad_cache_none_open' does not exist.
Invoking cache function 'adserve_cache_open'.
Drupal bootstrap '8'.
Hostid: 'none'.
adserve_invoke_hook hook(init) action(first)
adserve_cache function(hook)
Cache function 'ad_cache_none_hook' does not exist.
Invoking cache function 'adserve_cache_hook'.
adserve_cache function(get_cache)
Cache function 'ad_cache_none_get_cache' does not exist.
Invoking cache function 'adserve_cache_get_cache'.
adserve_cache function(build_hooks)
Cache function 'ad_cache_none_build_hooks' does not exist.
Invoking cache function 'adserve_cache_build_hooks'.
Did not find hook 'init'.
Function 'adserve_hook_init' does not exist.
adserve_cache function(id)
Cache function 'ad_cache_none_id' does not exist.
Invoking cache function 'adserve_cache_id'.
Unsupported type 'host'.
Searching tids: 163
adserve_cache function(id)
Invoking cache function 'adserve_cache_id'.
Total ads: '2'.
Already displayed: 0
adserve_cache function(validate)
Cache function 'ad_cache_none_validate' does not exist.
Invoking cache function 'adserve_cache_validate'.
Validated ads: '2'.
adserve_invoke_hook hook(filter) action(intersect)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Invoking hook 'filter'.
Including file: '/usr/webserver/content/drupal/docs/sites/all/modules/ad/channel/ad_channel.inc'.
Invoking 'ad_channel_cache_filter'.
ad_channel_cache: adserve_cache_filter
adserve_cache function(get_cache)
Invoking cache function 'adserve_cache_get_cache'.
ad_channel_cache: checking aid(2638)
ad_channel_cache: aid(2638) has no channel info [0]
ad_channel_cache: aid(2638) is valid if no valid ads found in current channel
ad_channel_cache: checking aid(2639)
ad_channel_cache: aid(2639) has no channel info [0]
ad_channel_cache: aid(2639) is valid if no valid ads found in current channel
ad_channel_cache: using ads with no channel info
adserve_cache function(get_cache)
Invoking cache function 'adserve_cache_get_cache'.
ad_channel_cache: aid(2638) is not a premiere advertisement
ad_channel_cache: aid(2639) is not a premiere advertisement
ad_channel_cache: returning non-premiere advertisements
Filtered ads: '2'.
adserve_invoke_hook hook(weight) action(first)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'weight'.
Invoking 'adserve_hook_weight'.
Weighted ads: '2'.
adserve_invoke_hook hook(select) action(first)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'select'.
Invoking 'adserve_hook_select'.
Randomly selecting ad 1 of 1.
Randomly selected ID: 2639.
adserve_cache function(validate)
Invoking cache function 'adserve_cache_validate'.
Selected ads: '1'.
adserve_cache function(display)
Cache function 'ad_cache_none_display' does not exist.
Invoking cache function 'adserve_cache_display'.
adserve_cache function(display_ad)
Cache function 'ad_cache_none_display_ad' does not exist.
Invoking cache function 'adserve_cache_display_ad'.
Ad type 'image', loading module ''
ad:

Only local images are allowed.

adserve_cache function(increment)
Cache function 'ad_cache_none_increment' does not exist.
Invoking cache function 'adserve_cache_increment'.
adserve_increment action(view) aid(2639) hostid()
Drupal bootstrap '8'.
adserve_invoke_hook hook(increment_extra) action(merge)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'increment_extra'.
Function 'adserve_hook_increment_extra' does not exist.
adserve_increment extra()
adserve_cache function(close)
Cache function 'ad_cache_none_close' does not exist.
Cache function 'adserve_cache_close' does not exist.
adserve_invoke_hook hook(init_text) action(append)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'init_text'.
Function 'adserve_hook_init_text' does not exist.
adserve_invoke_hook hook(exit_text) action(append)
adserve_cache function(hook)
Invoking cache function 'adserve_cache_hook'.
Did not find hook 'exit_text'.
Function 'adserve_hook_exit_text' does not exist.
document.write('\x3cdiv class=\"image-advertisement\" id=\"ad-2639\"\x3e\x3ca href=\"https://beta.ischool.utoronto.ca/ad/redirect/2639/t163\"\x3e\x3cimg src=\"https://beta.ischool.utoronto.ca/sites/ischool/files/ischool_profile_pic...\" alt=\"Test\" title=\"Test\" width=\"150\" height=\"150\" /\x3e\x3c/a\x3e\x3c/div\x3e');

Jeremy’s picture

In the previous example, you were trying to display ads in the group with a tid of 165. Now you're displaying ads from a group with a tid of 163. All this tells me is that there are ads in group 163, and there are no ads in group 165. Why are you changing the group in your debug example?

dsellers154’s picture

I am having the same problem. I have an image ad tagged to a group "Med image" and to a channel "clothing". If I leave the channel to publish site wide, It displays fine. As soon as I limit the channel to display only on one page, or on every page but a page, the ad totally dissappears. I am not sure if this has to do with the other error I was getting "validate error, setting the add to pending". I commented out part of the image module to over-ride this problem.. I am not sure what other info to put here?

Thanks

Jeremy’s picture

@dsellers154: please review documentation/DEBUG.txt and follow the directions here. You can post the output to this ticket if you can't track down the problem yourself.

dpopov’s picture

In 6.x-2.0-rc1 specific URLs works only if you enter relative paths without synonyms, like that: node/111 or taxonomy/term/3.

modulist’s picture

I've noticed the same thing with version 6.x-2.1. Only node numbers seem to work for me. URL aliases are ignored completely.

Until it's fixed, the instructions on /admin/content/ad/channel/channel should read

URL rules
( ) Display advertisements from this channel on the pages with the following node IDs: 
( ) Display advertisements on every page except those with the following node IDs: 

Display advertisements only on the listed node IDs: 

Otherwise, it's WAY too buried in the fine print.

czeky’s picture

not working for me either, I'd like to display channel on pages like /region/usa/chicago/* , so as I understood, not possible yet?

edit: url aliases made by pathauto.. channels are defo great idea, and exactly what I need, is it possible to make this work (again)? mean restricting on url basis where would be ads displayed..

Jeremy’s picture

Category: support » feature
Status: Postponed (maintainer needs more info) » Active

The URL is passed in in function ad(). The following code does it:

      if (isset($options['url'])) {
        $query['u'] = $options['url'];
      }
      else {
        $query['u'] = $_GET['q'];
      }

To solve, we'll need to _also_ pass in a list of all aliases for the given URL, perhaps as a comma separated list. However, there's no limit to the number of aliases that can be defined for a given page, so we risk creating a URL that is too long for the web browser. Offhand, I don't have a solution for this other than to document this known limitation.

The 'u' variable is also used in function ad_redirect(), however there it's fine to record the actual URL as the various aliases can be calculated easily enough at that point.

BTW: If you _only_ care about aliases, you could try changing the else portion of the above snippet from ad() to read as follows (it's a quick kludge, but it should work):

      else {
        $query['u'] = $_SERVER['REQUEST_URI'];
      }
Jeremy’s picture

Status: Active » Fixed

This turned out being rather easy to implement, so I went ahead and committed it:
http://drupal.org/cvs?commit=277540

Note: it uses the built in drupal_get_path_alias() function to determine the correct alias for a given page, and this function only returns one alias no matter how many are set for the given path. Thus, if you set multiple aliases for a path, only one of them will actually get matched. If that's a problem for you, I recommend using a module such as this one:
http://drupal.org/project/globalredirect

czeky’s picture

hi, that would be great, are You planning to release this for download? Many thanx for helping me..

czeky’s picture

Hi, installed whole module from repository and got parsing errors, are there some secrets? ;-D thanx

Status: Fixed » Closed (fixed)

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

neubreed’s picture

Hi Guys,

How can I override channel settings to display ads using ad() method?
For now its displaying the banner as mentioned in the channel settings.

Any help would be highly appreciated!

Cheers,
Ashish

ressa’s picture

Version: 6.x-2.0-beta3 » 6.x-2.x-dev

My original post was about how I couldn't get "Display advertisements only on the listed URLs." to work with 6.x-2.x-dev, but I should have started with the official release, 6.x-2.2 which works fine. But it does not work for neither 6.x-2.x-dev nor 6.x-3.x-dev.
Thank you for a great module!