• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Digital Point Ad Positioning

digitalpoint

Well-known member
#18
I started mucking with this again...

The main problem is that XenForo's URL structure is very good SEO-wise, so you can't extrapolate what post the user is actually looking at from the server (URL hashes like #post-xxxx are not sent to the server by the web browser). So ultimately we are left with everything before the hash in the URL to try and figure out what post the user is actually seeing. In vBulletin this much easier because their URLs suck (you can just key on p=xxxx in the URL to know what post the user is looking at).

I don't want to make things extra complicated and add queries just to make the determination for which post to display the ad in.

So far, I made it so it makes an educated guess based on the information we already have... Basing it on the first unread post on the current page you are viewing (which often should match up with the hash in the URL if you got there by clicking a link to view new posts in the thread). If nothing on the current page is unread, then just default the ad to the first post in the thread.

It's certainly not ideal/perfect, but it should get the ad in the post being viewed *most* of the time... and the times it doesn't, it will put it in the first post on the page.