I'm starting to run a few ads on a website, and I'm trying to decide the best way to track performance.
Specifically,
What's the most efficient way to count clicks? About the only way I can think of is to link the ad to another page with the ID of the ad as an argument (e.g. adserver.aspx?id=1234). The other page would then update the database and do a redirect to the advertiser's link. However, it seems inefficient to have to load a separate page for this. Are there any other options?
Also, it seems like I might need to know stuff like how many clicks occurred in a given week. But storing a separate database row with a date for every single click seems excessive. Has anyone else done something like this? Would it make sense to maybe create a new row for each week and increment a counter for all clicks that occurred that week?
Any tips appreciated.
I'm starting to run a few ads on a website, and I'm trying to decide the best way to track performance.
Specifically,
What's the most efficient way to count clicks? About the only way I can think of is to link the ad to another page with the ID of the ad as an argument (e.g. adserver.aspx?id=1234). The other page would then update the database and do a redirect to the advertiser's link. However, it seems inefficient to have to load a separate page for this. Are there any other options?
Also, it seems like I might need to know stuff like how many clicks occurred in a given week. But storing a separate database row with a date for every single click seems excessive. Has anyone else done something like this? Would it make sense to maybe create a new row for each week and increment a counter for all clicks that occurred that week?
Any tips appreciated.
Share Improve this question edited Jan 20, 2011 at 21:21 Jonathan Wood asked Jan 20, 2011 at 18:25 Jonathan WoodJonathan Wood 67.5k82 gold badges304 silver badges532 bronze badges 3- 1 "it seems inefficient to have to load a separate page for this" This sentence tells me your HTTP knowledge is not up to par. – Josh Stodola Commented Jan 20, 2011 at 18:37
- @Josh: I would somewhat agree with Jonathan. Why call the page, wait for the server to process it, receive an HTTP Redirect (or similar), request the new page, wait for the server to process it... ? Basically, you're waiting for 2 roundtrips. With JavaScript you can cut it to one roundtrip for displaying the page, then a lighter-weight AJAX call to log the click. – Nelson Rothermel Commented Jan 20, 2011 at 18:47
- 3 @Josh: Thanks for posting a ment that adds absolutely nothing to the conversation. The fact is that there is a fair amount of overhead processing an ASP.NET page request. – Jonathan Wood Commented Jan 20, 2011 at 20:52
2 Answers
Reset to default 5I would suggest that your first solution is the best option, in fact it is the design that most similar systems (OpenX, Google AdSense etc) employ. Additionally it helps you better managed your banners and prevents your site leaking search engine spiders.
As for performance that is just a question of having a good design, in a typical design the redirection script will be fairly lightweight so should process requests fairly quickly. It is worth mentioning that you could thread off the DB updates to reduce the redirect request response times.
There is of course another option:
Rather than homebrew your own banner serving scripts look into implementing OpenX instead, it is free and an extremely good piece of software. OpenX can be found here:
http://openx/
and here for the open source version you can run on your own server:
http://www.openx/publisher/open-source-ad-server
Another option would be to implement something like Google AdSense and save yourself the hassle of finding advertisers etc. Google also provides tools to allow you to sell banner space and then fallback to default AdSense banners if you have no active advertisers (OpenX will also do this and also support integrating AdSense (and other advertisers))
You can do it with JavaScript.
Opening the page:
- Send the ad URL to the client
- When the user clicks the ad, use JavaScript to open the URL. Or, simply use an anchor with
target="_blank"
.
Logging the click:
- Either way, hook a JavaScript function to the ad click event.
- When the user clicks the ad, use AJAX to call a web service. The web service will then log the click.
This way the ad opens as soon as possible, then the browser asynchronously municates with the server for logging.
The question is, what happens if the user clicks the ad, the page opens, then the web service call fails? If you would prefer, you could call the web service first, then and only if the call succeeds, open the ad. Probably not the best from the end user's perspective.
For you question #2: Storing each click gives you the most reporting flexibility later. If you are set on weekly reports, why not set up a weekly process that generates the reports you need, then cleans up the data? You could even skip cleaning up the data for now until space or speed bees an issue.
Would it make sense to maybe create a new row for each week and increment a counter for all clicks that occurred that week?
Probably not. Only one process can update the counter at a time, otherwise you'll lose data. The locking that has to occur to get the value then update it will probably significantly slow down.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744936229a4602041.html
评论列表(0条)