Closed (won't fix)
Project:
Google AdSense integration
Version:
5.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Nov 2007 at 22:30 UTC
Updated:
6 Aug 2008 at 17:03 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kbahey commentedYes, the old code still works. My sites have channels working just fine.
If someone submits a working and tested patch for the new channel system, I will sure commit it in a new version.
Comment #2
ench0 commentedIf by "work" you mean "still gnerate money" - yes, that is true. Channel data is not recorded however. Money goes into your AdSense account, but is not attached to any channel.
As a matter of fact, in the last few days the channel for my Drupal site became "Inactive" in google AdSense, obviously because no data is coming in from that channel. You can check these two sites if you like:
http://www.startupaide.com - not a Drupal site, adSense code is pasted into HTML, data is reported properly, and channel is not reported as inactive in google adSense.
http://www.easymortgagetips.com - a Drupal site using the AdSense module - channel is considered inactive by google adSense.
Comment #3
kbahey commentedI am using the adsense module on 3 Drupal sites.
My channels are working just fine. They get recorded just like they have always worked. That is true for yesterday's and today's data even.
So, I don't know why they don't work for you.
In anycase, the new code needs to be done. I don't have time for that, so if someone creates a working and tested patch, I will include it.
Comment #4
hquadrat@hquadr.at commented[subscribing]
Comment #5
ench0 commentedkbahey, I can believe that the ads work fine for you and the channels are properly tracked in your AdSense account. Now - considering the fact that I am not the only one who reported this bug, as you can see "visible" also reported the same problem - can you also trust us that there is a problem with the AdSense module and that it needs to be addressed?
The problem is:
As of November this year google AdSense no longer uses the chanel name and ID for tracking the ads. It now uses "google_ad_slot", e.g.
google_ad_slot = "5200235980"
I suppose the reason for this is a) shifting the responsibility for keeping track of the ads details from the advertisers' web-server to google adsense, b) better security and c) more precise tracking/analytics. Having a number, such as 5200235980 conveys way less information to anyone snooping around your site and analysing the ads as compared to a channel name, e.g.
google_ad_channel = "easymortgagetips";
And also, this way it is possible to do finer tracking as you are now able to track the performance of each ad slot in your channel as opposed to tracking and on a per-channel basis.
Whatever google's reasoning, the result is that google_ad_channel is now obsolete, it will not provide tracking stats to your account and instead google_ad_slot should be used.
I don't know why the tracking works for you. It may be that you are outside of North America and the changes have not yet been implemented in your region? It is easy to test. Go to AdSense and create a new channel and examine the code. If you still see google_ad_channel in your ad code then that's exactly what's going on. If, however the code for your newly created channel contains google_ad_slot instead of google_ad_channel then it should be obvious to you that the old AdSense module will not work correctly with the new google ad format.
Here's examples of the two formats pasted "as-is" with 0 modifications from two of my web-sites. One is generated by the AdSense module (and is wrong) the other one I copied and pasted manually into my static HTML files on my other site which does not use Drupal.
Generated by Drupal (from http://www.easymortgagetips.com)
===============================================
<div class="adsense">
<script type="text/javascript"><!--
google_ad_client = "pub-8954313109710180";
google_ad_type = "text";
google_ad_channel = "easymortgagetips";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_color_border = "CCCCCC";
google_color_bg = "FFFFFF";
google_color_link = "E1771E";
google_color_url = "0066ff";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
As suggested by AdSense for my startupaide channel (http://www.startupaide.com/)
================================================================
<script type="text/javascript"><!--
google_ad_client = "pub-8954313109710180";
//startupaide 120x600, created 11/12/07
<strong>google_ad_slot = "2203668301";</strong>
google_ad_width = 120;
google_ad_height = 600;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Basically the AdSense module must be changed to allow users to specify google_ad_slot instead of channel and also the HTML generated by the module needs to be changed accordingly.
Comment #6
hedac commentedI agree that it should be updated to insert the ad slot and insert the code in the new way...
but my channels still appear to work with the old code
Comment #7
visible commentedWell, it is very disappointing to see that this got absolute nowhere since I reported the changes.
So I will assign this to myself and will see if I can try to frankenstein a solution.
Comment #8
kbahey commentedI am not disputing that there is a problem. I am saying that I do not see it, and hence can't fix it. This is in addition to the fact that I don't have the time to spend on this, and there is no reason for me to do so since it is working on my sites.
As always with Open Source, those who face an issue, or want a feature, have to provide a fix for it, hence scratching their own itch. So please provide properly formatted, working, and tested patches, and I will include them in the module.
Read http://drupal.org/patch on how to create patches.
Comment #9
Petra commentedI use AdSense in germany. New code for AdSense is like ench0 posted. And old code still works (with channels).
Google informed me that he implemented a new feature for the ads: no need to change colors and channels in websites. With the new code I can change this in my google account. But google didn't say that old code must be changed or it will no longer work.
The adsense module doesn't support this new code. But since old code works and in the google-channel-overview the id for each channel is listed - I could use the adsense module (with channels) for old and new sites.
Comment #10
jimmyeao commentedHas anyone found a way of making the new adsense code work, with or without this module?
Comment #11
Petra commentedWithout this module it's pretty easy: put the adsense-code in a block and place the block where you want - works fine.
I didn't test new channels with this module. I only know that you can get the channel-id for new channels from your google-channel-overview. The id for each channel is listed there. (and old channels work with this module)
Comment #12
Artem commentedSubscribing
Comment #13
dduane commentedFriends, is there a solution for this code problem as yet?
I ask because my click records stop abruptly on December 31, 2007 -- even though there have been plenty of clicks since then (as I've confirmed by checking at Google). I don't have my clicks "channeled" at all, BTW.
I just updated my module to 5.7 (having just updated my installation from 4.7 as well) in hopes that the problem might have somehow put itself right. No sign of this as yet, however. :)
Best -- Diane
Comment #14
kbahey commentedWe need a properly formatted and tested patch which a few people can confirm is working.
So far, this has not happened.
It has to based on the new 2.x code.
Comment #15
kwgossett commentedHello all,
As a new drupal user, I'm curious why I need to use the AdSense module. Can't I just insert the code in the left/right margins, where they belong? ....or if not, create a block and put the code there? I guess I'm missing some fundamental piece of info here on 'why the module?' What purpose does it serve, etc?
I am also a bit concerned that some improper coding will get me banned from google.
Thank you,
Kelly
Comment #16
kbahey commentedPlease do not crowd existing issues with unrelated questions.
Either go to the forums and ask your question, or open a new request.
This will make it easier for others to follow up on the real issue at hand.
Thank you for your cooperation, and welcome to Drupal.
Comment #17
911 commentedHi,
I read your issues related to the new Adsense Code and not working Channel tracking.
I am located in Germany and using Adsense. The adsense javascript code has changed the same way for me like you guys posted. google_ad_slot instead of channel, color, etc.
But like it was said before, the old adsense codes do still work. Same for the channels. You can still find your channel ids in the adsense settings. Adsense Setup -> Channels. Also you can create a new channel there and use it for the adsense modul. Works fine. If you have problems with your channel tracking, I am shure it is not related on the old adsense code. Perhaps send an email to the adsense support and report your problem (did someone of you guys with channel problem already do this?! Perhaps you can post the answer from google.).
@ench0
You postet above in your old code:
google_ad_channel = "easymortgagetips";
You have to look for the Channels ID, not the channel name. Perhaps this is your mistake?!
Best Regards
Comment #18
kevinwelker commentedAll,
Here is a patch to add support for the following
1. Spec. the Adsense slot ID
2. Use a Google Adsense Referrer type Ad
3. Spec the CPA choice for a Referrer type AD
* I didn't remove the code to add a channel because it wasn't clear to me it's no longer needed just yet. It's not hurting anything currently that I can see.
I have tested pretty well except for two things:
1. I don't have search ads setup so I haven't tested search at all.
2. I don't have a CPA value to test with either so I didn't test with a specific value configured in my block. An empty value was required for the referrer ads to work for me.
Can some one test this with search before it's committed? I've attached the adsense.module in a zip as well as the patch so you don't have to mess around with the patch for testing if you don't want to. Let me know what you run into and I'll see if I can resolve it.
Of course, please back up your current adsense.module before using this version.
Thanks,
Kevin Welker
Comment #19
kbahey commentedThanks for this Kevin.
The only thing that concerns me is the number of arguments in the functions now. Should we convert that to a keyed array instead of discrete arguments? Or leave that till 6.x?
Here is the same patch, changed to proper unidiff format for those who want to apply it themselves, and has some formatting fixed (tabs, indentation, ...etc.).
Can a few people test both the functions Kevin left out as well as the standard ones.
I also included a pre-patched version after the above changes.
Comment #20
kbahey commentedAnyone tested this?
Comment #21
kevinwelker commentedI am using the module on a low traffic site without issue, but again I still haven't looked at search. I'll try to test it in the near future and if I need changes otherwise, I'll make updates to group the arguments as you recommended.
dduane or 911, have you tried it?
Regards,
Kevin
http://www.linkedin.com/in/kevinwelker
Comment #22
Chad_Dupuis commentedJust in case this is helpful for anyone, I made some changes to the module code to allow google's new manage ad features which is where the _slot comes from. This module will not work with new channels regardless of what you name the id based on my experience. The _slot is for the managed ad features, not using the legacy code. What I did to make the module work (which I needed for the adsense injector functionality - otherwise I would just use blocks, themes, etc.) is the following:
In the module change this (starting at line 1163):
Change it to:
Then when you go into Google Adsense, create a new managed ad, get the code and place the following in their respective fields:
In the adgroups section it won't matter what any of the colors are, the only field that matters now is the managed ad name in the "alt info" field. This is the name that is between the /* and */ in the google code.
Then in the custom channels section you can put the managed ad id (the slot #) instead of the old legacy code.
Then you can pull the managed ad up just like before - i.e. 300x250:4:4 where 4 is the name of the managed ad (alt_info field) and 4 is the slot id from the custom channels section of the module.
You can see it in action on my site http://www.yinyanghouse.com/ - as an example - http://www.yinyanghouse.com/basics/simple_meditation_techniques
Comment #23
kbahey commentedIt would really help if people focus on the patch and pre-patched version in #19, and test them and give feedback on whether they work or not.
This is stopping the move to Drupal 6, so please focus on getting this in ...
Comment #24
stroobl commentedI applied the patch of #19 and added 3 new blocks on www.stroobant.be to test it.
So far everything seems to work fine, I'm waiting for some Google reports now.
Example out of one of the blocks:
Patched adsense module:
Original Google code:
I'm always willing to do more tests if required. This is the only module I'm waiting for to update my site to Drupal 6, so please let me know I can help you with something else. :-)
Comment #25
stroobl commentedThe ad_slots work as expected.
I also created a referal block, seems to work too.
Google code:
Adsense module:
Comment #26
kbahey commentedI committed this to 5.x-2.x-dev.
Will not do a stable release of it until I get more feedback that it is all good.
Comment #28
kbahey commented@supachaiMD
We are testing here the new Google Adsense code using the 5.x-2.x-dev tarball.
If you are not specifically helping in testing this, then use the 5.x-2.0 and open new issues for problems you find, not this particular issue that deals with the new Google Adsense code.
@All
Please test the -dev tarball so that we can move to a Drupal 6.x port once this is confirmed.
We need to test the search too.
Comment #30
ench0 commentedExcuse me for a post which is somewhat unrelated:
I would like to stop receiving emails in regards to this thread as well as all other adsense-related issues. I could not see an obvious way of unsibscribing neither on this page nor on My Issues page nor anywhere else...
Could someone please let me know how to do it?
Comment #31
kbahey commented@supachaimd
The search box works for me for the latest 5.x-2.x-dev. At least on a test site, it does not give a 404, but a Google search result page.
@ench0
Visit here and change it to what you want: http://drupal.org/project/issues/subscribe-mail
@all
Any more testing of this before we create a stable release, and move on to Drupal 6?
Comment #32
jcnventuraHi,
I have enabled this on my site, and at least it is working as well as the 2.0 version.
However, while trying to add the slot info, I discovered that my preferred method (the input filter), was not yet modified to enable this. The attached patch fixes this, and I have tested it in my site.
Change description:
Enabled the capability to specify 'Search Box' as the format, and an optional extra argument: the slot.
Change referrer to referral to comply with the input format help (and the rest of the adsense code).
The rest of the changes are to pass the necessary slot parameter to to adsense_display and some documentation changes to document this new parameter. During the documentation editing, I corrected also the input filter help to specify the adsense:block syntax and not the (to-be-deprecated) flexiblock, and I have documented the adsense:referral filter in the adsense_help.inc.
Comment #33
kbahey commentedI committed your patch to 2.x-dev.
Thank you.
Comment #34
jcnventuraThanks for committing it so fast..
I was just testing the referral input filter and something seems to be strange with it, as I wasn't able to make it work as it is now. Changing the last two groups in the pattern makes it work, but I don't understand why.
Anyway, I would like to suggest the following optimization. The new google code only uses the following vars: google_ad_client, google_ad_slot, google_ad_width, google_ad_height (and google_cpa_choice for referrals). The adsense module outputs the following extra vars: google_ad_type, google_ad_channel, google_ad_format, google_color_border, google_color_bg, google_color_link, google_color_url and google_color_text. My suggestion is to make an if clause in the appropriate place to only output these variables in case $slot is empty.
As long as Google is supporting both code formats, this would be the best that the adsense module could do to keep everyone happy. Of course, when using slots, the channel and group info is completely ignored, so eventually there should be a way to not have to specify any of that.
Comment #35
jcnventuraHi,
I have made the referral link work (my CPA includes a dash, so this needed to be included in the pattern).
Also, I have changed the adsense_format function to work as explained above. If slot is defined, only the client, slot, width, height and cpa_choice are output. I have tested this on my site and the output alternates between the new format and the old format depending on whether slot is specified.
I have also made the group and channel info optional in the input filters (the colons remain mandatory though), so it is now possible to specify [adsense:468x60:::3201234] to create a 468x60 advert with slot id 3201234. It looks strange, so what do you think of adding a couple of patterns totally without the group and channel?
Finally, this patch adds the missing 200x90 links ad.
João
Comment #36
kbahey commentedI committed your last patch. Thanks.
What are you proposing as new formats? Please explain that more.
Comment #37
jcnventuraWell, regarding the input filters, my suggestion would be this:
The pattern matching would easily differ between the two... There should also be a new adsense_display function without the group and channel but that can be left for a later adsense version.
Other than that, I think that I we can mark this fixed and move on to the 6.x version :)
João
Comment #38
kbahey commentedI need 2 or 3 positive confirmations from people who test the -dev tarball that everything is OK, including old style ads, as well as new code.
After that, we can close this and move to 6.
Comment #39
sp-one commentedHi,
A newbie to Drupal and some one give a step by step procedure to implement the Adsense patch.
where can i download the patch and how can i implement it.
My site is on shared serveri. new to linux as well. I have 5.X drupal version installed.
Please excuse me for my ignorance.
Thanks
SP-one
Comment #40
kbahey commentedYou don't need to patch anything if you want to test the 5.x version that has the new Google code.
Just download and install the 5.x-2.x-dev tarball as usual.
Comment #41
Petra commentedOld Code works - in basic and revenue-sharing.
My Code for a referral block (made with german google) looks like this:
There is no width and height, but output and format.
It does not work - no ads are shown. I don't find other referral-ads in the adsense-setup.
New Code (with slot-ID) does not work with revenue-sharing. This makes sense, cause slot-ID is combined with publicher-ID and if publisher-ID changes, slot-ID is not available for this publisher (Website not found is shown instead of the ad).
Slot and Referral should be disabled in block-konfiguration, if revenue-sharing is enabled.
Comment #42
jcnventuraHi,
Regarding #41, text referral links are not supported at all by the adsense module (old code or new code). At least there's no way to specify ref_text as a valid google_ad_format.
I can try to came up with something that will handle ref_text as a valid format, but it would be nice to see what the 'old code' for such a format is. Without that, the output of specifying ref_text as a format, but not supplying a slot ID will probably be invalid.
As to the new slot + revenue sharing... I don't see that it can be fixed in the module (it would mean saving a slot id array per adsense unit inside Drupal so that the slot-id could be matched with the publisher ID). So indeed, we need to disable slot use when revenue sharing is being used.
With all these differences between 'new format' and 'old format' uses, I am starting to wander if the adsense module should not be forked into two versions depending on the format being used. I am fully 'new format' in my site now (the old format channels never worked for me), so I see so a lot of useless code inside the module for handling format groups and channels, etc... I am not saying that the current module should stop supporting the slot id, it's just that so much could be deleted for sites that don't do revenue sharing and are only using the new format. And after the fork is done, there's no reason why both modules could not be enabled simultaneously, if it is done right.
João
Comment #43
kbahey commented@jcnventura
I think this is a good idea. But not a "fork" in the normal sense.
A better term is pluggable support. We have two .inc files, one called new.inc and the called old.inc.
Each one generates the code differently according to whether it is old or new, and then the admin gets to select which one to use. For Drupal 6, we can default to the new version, and allow the admin to chose the old, and we do it the other way for Drupal 5 (assuming there will be a lot of people that already have old code).
This will keep the code clean and simple, and perhaps reduce the number of arguments we have now in the -dev version.
So, the questions are, for everyone to comment on:
1. Is this a good idea?
2. Any further improvements to it?
3. Can anyone provide a patch for this?
Comment #44
Petra commentedI don't have 'old code' for such a format, cause I don't use this and I can only generate 'new code'.
I think that 'new code' is not practicable with revenue-sharing. Imagine only one author to share revenue and 4 different ad-formats. You have to tell the author to generate 4 ads with your ad-sizes (width and height) and your colours. Then the autor must submit the slot-ids for each ad-format...
So 'old code' is needed to make revenue-sharing practicable. 'new code' or new.inc should be disabled, if revenue-sharing is used.
Comment #45
jcnventuraOK.
I googled for 'google_ad_format = "ref_text";' and I found an old style example.. Basically, for a ref_text, only client, output, format, choice and channel are needed.. So it's not that complicated to make the necessary changes...
The included patch tries to do that. Can someone test it? You need to specify your ad with format type "ref_text".
Comment #46
jcnventuraRegarding #43:
It's not simply a matter of new_code.inc and old_code.inc.. Virtually it's a different module..
Without support for the old code, the following stuff is completely extra to the module:
- channel selection and configuration
- group/colour selection and configuration
- the revenue sharing module
- internal cache (why do it if the new format output is oh, so simple!)
- API (if you can't change the client ID...)
Keeping a new.inc and an old.inc to manage the above means creating a 'shell' adsense module with two very similar format sub-modules. The basic and revenue sharing modules would then be sub-sub-modules of the 'old format' module.
Anyway, as it is now, the module supports both formats perfectly, even though the revenue sharing module only works with the old format.
João
Comment #47
vinayakg commentedNo need to include the channel data inside code.
You can track adsense reports via url channel.
Login to adsense account and create a url cahnnel.
This is the best option.
Comment #48
Pushkar Gaikwad commentedok so I am using 2.0 and since though ad_slot is same as ad_chaneel, the clicks are not getting counted under channel. Can you tell me which is the working patch to make this module working with new adsense code ?
Comment #49
jcnventuraTo work with the new adsense code you need to use the 2.x-dev version, which already includes the patches discussed in this thread.
If it works for you, please say so here afterwards.
Comment #50
datawench commentedsubscribe
Comment #51
Pushkar Gaikwad commentedso how to update the module ? replace older files with new once and run update.php or shud I remove the adsense module folder from modules directory and replace it with new dev one and than run update.php ? what will happen to adsense_injector ?
Comment #52
jcnventuraSince referrals are being phased out by Google, the patch in #45 is irrelevant (or it will be in September).
The new code patches that I submitted in #32 and #35 have been in 5.x-2.x-dev for +3 months now. I believe it's time we close this issue. I am moving it to code needs review as it was in #38, as the only 'doesn't work' report (#41) was about text referrals.
Can we assume that +3 months without any further 'doesn't work' reports and since this has already been committed, that this issue can move to 'fixed' at least?
João
Comment #53
Pushkar Gaikwad commentedI have used the new dev version but still its not tracking the channels, so I have stop using this wonderful module and move back to the ugly hacking theme and insert adsense way :(
Comment #54
jcnventuraTo poseidon123: Can you please clarify? Which version have you used? The current 5.x-2.x-dev?
Have you noticed any difference in the code generated by the module and the one given to you by Google?
João
Comment #55
alexanderpas commentedupping this to critical, as google doesn't provide the old ad-code anymore...
Comment #56
alexanderpas commentedhehehe....
Comment #57
jcnventuraYou can up to critical all you want.. The patch needs review and nobody is saying 'It works for me'...
Comment #58
kbahey commentedThis is superceded by the following http://drupal.org/node/265666 really. I am tempted to mark it as duplicate even ...
Comment #59
alexanderpas commentedyes and no... seeing as this issue is agains 5.x-2.x-dev... and the other one at 6.x-1.x-dev they're certainly related... but this is certainly not a duplicate...
I think postponing this one to get the new code ready for D6 (and D7 when it is ready) and backporting that code for 5 is a solution.
however... this code needs review... (might do that myself when i have some time, but can't guarantee anything...)
Comment #60
kbahey commentedThe code from this has been reverted from the 5.x-2.x-dev tarball. It was too convoluted, too many arguments in functions, ...etc.
The new Drupal 6 version will have support for Google's new code.