Forum Moderators: martinibuster

Message Too Old, No Replies

Do you code webpages in JavaScript?

         

peterinwa

8:35 pm on Jun 12, 2004 (gmt 0)

10+ Year Member



I think I have a very unique situation. My website is a calculator where you calculate calories in activities and foods. I would like my AdSense ads to change with each calculation so you might get ads about running or swimming or bread or hamburgers. It works this way on the dictionary website where the AdSense ads reflect the word you "looked up." Search for a different word and you get different ads.

My problem is that in order to display the results of the calculator, I completely regenerate the page on the screen with each calculation. This is why I code my pages in JavaScript, and of course the JavaScript generates the pages in HTML.

But I don't know how to incorporate the Google ad code into the JavaScript/HTML code for the page. And Google won't let you mess with it. (If I could figure out how to do it I might ask them.)

I work around this by using two Frames. One holds the ads and the other the calculator. So what happens is that someone may spend 20 minutes making calculations of different activities or foods but during those 20 minutes the ads stay the same. If the ads changed with the calculations they would get much more attention. I would make more money, and so would Google!

Any ideas?

Thanks, Peter

ChrisKud5

8:52 pm on Jun 12, 2004 (gmt 0)

10+ Year Member



Can you get the "response" of the caluclator results (that may say eat cheeseburgers or lay off the carbs) to send the user to another page where the text for the results would be contained as would adsense code?You would need the text output from your calculator to be on a page when the adsense is loaded.

Maybe you could generate an event on the calculate results that loads the adsense code into a frame AFTER the results appear so adsense has text to target off of.

I am not sure exactly how the adsense codes targets. I thought that it used to be targeted based on the URL and file name, and entered into a databsae as index.asp is about atkins, low carbs, etc.

You may want to incorporate dynamic pages with adsense on them. I have this in a site search and it targets ads very well. You can set up values based upon the numbers the calculator uses. So if I say I consume xx carbs and xx fat (or whatever your case may be) the page will submit to a parser that evaluates the the inputs and gives outputs based off of this. So if i put in 20 carbs and 50 fat the page goes to yourdomain.com/calculate/calculate.asp?carbs=20fat=50

you can specify the ranges for specific output, so you can have carbs 20-30 and fat 20-30 display text that talks about increasing carb intake or whatever.

In my search system search terms and done like this, results are placed on a page and adsense code is added. The adsense code is 9/10 times about the search term (since a lot of the results have language congruent to the search term).

I think you may want to look into displaying results on a results page where the adsense is loaded on that page based on the input, so the input would dictate what the text would say and the text would dictate what the ads would say.

j4mes

8:56 pm on Jun 12, 2004 (gmt 0)

10+ Year Member



You could have the frame containing the ad change when the user selects certain parts of your calculator or does certain calculations, stuffing each different frame with keywords for the kind of ad you're after.

onClick="javascript:parent.AD_FRAME_NAME.location='AD_FRAME_PAGE.HTML';"

peterinwa

9:16 pm on Jun 12, 2004 (gmt 0)

10+ Year Member



ChrisKud5 that sounds like a great idea, but that is essentially what I am doing now. The only difference is that I am regenerating the same page rather than generating a different page. If I understand you.

Anyway, I don't know how to do anything server-side and so must do it all in the user's browser with JavaScript... and in generating a page with JS I don't know how to encorporate the Google ad code into it.

J4mes that's very clever. Though I would have to have countless pages for the different activities and foods. Or I could just create a dozen different ad pages and randomly select them to get some different ads!

The problem is that if I remember correctly this is "illegal" in Google's Terms. You can not manipulate the text on a page to get different ads. (Though I guess the spirit of doing it is pure... just trying to match the ads to the changing page.)

Thanks for the ideas!

ChrisKud5

9:25 pm on Jun 12, 2004 (gmt 0)

10+ Year Member



I do not know much about JS.

Is it possible to click a button, generate the results, and reload the whole page with the results saved client side?

Or, could the results be grabbed off of another page (or database for that matter) based on certain criteria, and have the fields grabbed off of the database with a SELECT * FROM RESULTS where ID=ID range specified with the input criteria. If this page was loaded with the adsense code on the page this would certainly be generating targeted ads. It would also be a very personalized "Your Nutrition Results are as follows" type thing.

I think you are OK if you are in the spirit of the google TOS. Your case seems to be wishing to target as best as possible to 1. increase CTR and 2. place advertisers ads that are relevant to your visitors interests rather than untargeted ads.

In your case it would appear OK to stuff keywords to generate targeted ads for the above purpose. I think google wants to avoid people stuffing high paying keywords in frames with adsense about X when the page is about Y.

I am sorry i am not well versed in JS but I do belive their will be options for you in your situation. I am sure other members here have a similar situation that will chime in shortly.

peterinwa

9:42 pm on Jun 12, 2004 (gmt 0)

10+ Year Member



ChrisKud5, the problem with reloading the page is that as the user makes many calculations I display them all on the screen and it can create a very long display. If it were shorter, I could save it in a cookie and then reload the page and display text/ads according to the content of the cookie. But it's too long for a cookie to store. I have to keep track in memory and this is why I can use JavaScript to regenerate the page but I can not reload it.

My activities calculator only uses one long list of activities. But my food calculator uses many different food lists. So I guess I could generate the text on the ad Frame to correspond to the food list. That way at least when the user changed food lists the ads would change. That would be progress! Also if the text said something about the food list I'm sure that would be okay with Google.

Thanks. Got me thinking!

ronin

1:48 am on Jun 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Rather than having the javascript generate the page on the fly you could pre-generate the pages offline (okay, I understand this will take a while, but it will be worth it) and then load them on to your server as static pages containing AdSense, which the MediaPartners bot can then spider as often as it wants to.

Then have your javascript pull up the static pages in the second frame. Instead of using the form information to generate a page, the javascript could use the form information to generate a URL which would correspond to the relevant static page.

Would that work?

In order to cover all the permutations of all the variables, there would, I'm guessing, be a very large number of pages, but it would give AdSense something solid to work with - and you could do all the generation offline beforehand.

peterinwa

2:33 am on Jun 13, 2004 (gmt 0)

10+ Year Member



Thanks for all the input everyone, but actually now I'm having second thoughts about this.

The people using my website are interested in diet and weight loss. If they calculate soda pop calories and get ads about where to buy soda pop, they aren't likely to click on them. As it is now they get diet and weight loss ads which is great.

The only problem being that if they sit there calculating for 20 minutes the ads never change. Whereas if they changed there might be more interest in them.

It would all work if I could just reload the page with each calculation, but I can't.