Reputation: 115
Is there a way to manage ads in a way that if i choose to show a certain ad, it will show to multiple sites that publish my ads in their sites. I'm looking into adding google analytics to add tracking.
I've looked into iframes but there are security issues.
Is there a way to accomplish this with javascript, just like how google adsense works? I was thinking of having some javascript and giving my publishers remote scripts to access the data.
Or is there a better way?
I'm don't want to use php because it is likely that the publishers are not using php and having a php script that pulls the data means it will not execute for sites that are in html.
SUMMARY: I'm looking for a solution thats in html and js. Any help is appreciated, and sudo code is always helpful if you can provide some.
Thanks in advance
Upvotes: 0
Views: 192
Reputation: 779
I worked at a spot that used javascript in order to render ads. This is how I accomplished it.
First, server type. I was running an NGINX web server with a PHP-FPM backend, with Varnish (cache) in front of it. The server was basically serving up static files, so this kept server load tremendously low. This is a decent tutorial for setting that up on CentOS
I used an Amazon Elastic Beanstalk, small instance type, to run this. It never needed to spin up more than one Small instance to serve somewhere in the neighborhood of 2.5MM javascripts per hour. Keep in mind, it's just serving small text snippets.
The tags looked like this:
<script type="text/javascript" src="http:/ads.someserver.com/1234"></script>
Where the [1234] was the tag ID number. Each publisher could have multiple tags, the ID keeps track of what publisher, ad size it is, etc.
Second, javascript. So now, you use an nginx rewrite in order to direct that request to a javascript file, which then in turn loads up the ad. The javascript file has to dynamically (and without libraries of any kind, load time is at a premium) create an HTML element, and then fill it with your ad.
You need to have another service of some kind choose what ad gets shown. This was not my department, but loading something up once you have the ID should not be difficult.
Figuring out where you should serve the assets (the ads) from is a tough call to make. Wherever you serve it from, better be super fast, because ad servers nowadays that you'll be competing against are super fast, and publishers will be very annoyed if your ad delays their website loading.
Good luck - you have a lot of challenges if you want to pull this off, least of which will be paying for servers to accomplish it.
Upvotes: 1