Ad implementation for multi-site questions


(Robbo) #1

Okay so we have our own ad system for inserting our ads into certain positions at runtime on our static sites. We are bringing in the same system for discourse and all is fairly well, you can see some in http://comunidad.sudandola.com/.

Now these work fine for the most part however they are all done with template overrides from admin, we need this to be done with a plugin so we can have them in sync over all forums. So I need to know a couple things.

How to make a plugin which injects in pretty much the exact same way as in admin customize?

What events I can hook into to trigger new ads on new views or view changes?

All the information I have found on plugins seems to be dated or just hard to follow, are there any documents on it that are solid or even some clear code to read?

Our ad system is very simple, I just need to be able to call a single line of javascript and insert a single line of HTML to make the relevant position work.

These questions are fairly simply but finding the answers has been harder than expected. I did start a plugin but didn’t know what hooks or classes to override to be able to put our own stuff into the HTML instead of the overrides.


(Rodrigo Farcas) #2

Also interested in this


(Jeff Atwood) #3

Any plugin samples they can look at here @eviltrout?


(Robin Ward) #4

I don’t think I have an example that does exactly what you’re doing. Probably the best example of a complete plugin that touches everything is discourse-tagging.

Having said that, you should also know I am just currently finalizing the Rails Girls Summer of Code project to working on an advertising plugin with similar functionality. It will take a while to deliver though (the target finish date is Sept).


Add text/ads on first post
(Rodrigo Farcas) #5

Hey @eviltrout , are there some tips you can give us that can be of help while implementing a 300x250 banner into discourse’s sidebar?


(Rodrigo Farcas) #6

I mean here: 2015-04-10_1800
Just asking for a quick solution, not the complete one you are working on


(Robin Ward) #7

That is a little tricky as it looks like it fits into the gutter where the links are usually displayed. Also, the post gutter as we call it is rendered via string instead of handlebars templates.