Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2007-12-05 14:41:06

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: smd_random_banner: Random banner image for advertising

Apologies if I missed this earlier in the thread, but since there is a limit value (which means you can have a list of say 5 banners below each other), shouldn’t there be a setting for the ordering of them? I understand if “random” is all you want (hence the name ;) but people paying extra money to get the topmost placement won’t, you know, be so glad :)

cheers,

Last edited by Anton (2007-12-05 14:41:33)

Offline

#92 2007-12-05 14:43:44

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: smd_random_banner: Random banner image for advertising

Another question (bear with me :): Is it possible to send an empty alt text to the banner? I’ve tried all I could but the alt value (a URL in my case) keeps showing up, thus invalidating my site.. :/

Offline

#93 2007-12-05 19:45:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_random_banner: Random banner image for advertising

Anton wrote:

since there is a limit value… shouldn’t there be a setting for the ordering of them?

I did kind of half consider this ages ago, then decided it was against the spirit of being random :-)

If you are trying to use it for paid-for adverts you’re probably out of luck anyway since it can only be told to grab images randomly from a list of categories that match (or don’t match) certain words. There is no ID support and I don’t think there is any way you could guarantee that a particular advert appeared in the rotation unless you have only one category set up with five banners in it and told the plugin to display five. The order will still always be random. Adding the ability to specify the order would be quite messy and involve code hacks; I assume you’re thinking of doing it by ID value? I could probably add a sort option but how would it help you? Could you explain how you intended to use the plugin to guarantee placement to your banner clients? I might be able to do something if it’s not a major hack.

However — and I don’t often say this — perhaps this plugin is not the tool for the job if you are using it in this way. It’s more designed for offering “something else” or “something related” (or just “something”!) to visitors that could advertise (and link to) another local or remote URL.

In your case, you’re probably just as well uploading your client banners to a specific image category and using the built-in <txp:image> tag to display them in a particular order. Or use 5 random_banner calls, and give each one a category holding one image :-s Alternatively there are probably plugins out there that allow multiple images to be displayed in order and can be given a limit attribute.

Is it possible to send an empty alt text to the banner?

Yes, don’t specify one in the Image tab for the image in question. You’ll get alt="" on the page ;-)

…the alt value (a URL in my case) keeps showing up, thus invalidating my site.

The plugin just uses the built-in image tag to display pictures so I’m at the mercy of that. It always displays the alt text and I can’t see a way of switching it off. If your URL is for banner-click purposes, I suggest using the caption field if possible, setting link_in="caption" and clearing out the alt field (or using it for an image definition to maintain a valid page).

Quite why the page does not validate with a URL in your alt tag is a mystery though. Does it contain odd quote characters?

This really isn’t your day is it! Sorry.

Last edited by Bloke (2007-12-05 19:46:57)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#94 2007-12-05 20:45:32

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: smd_random_banner: Random banner image for advertising

Thanx for your thorough reply, I understand the limitations of both the plugin and the image function better now.

In my case the banner solution is all the client paid for – they opted out a OpenAds variant and found the all-Textpattern solution better for them.

FYI, I made a slight modification for when the alt text contains a <script> tag, refering to banners hosted elsewhere, and also using the caption field to keep track of impressions (a URL to an empty image is stored there). These kinds of URLs seldom validate though (&amp; are most always coded wrong), hence my other question.

Your last suggestion sounds like reversing what I’ve instructed the client to do – this would benefit the validation I guess, but at the cost of confusing the client with changing directions.. I might consider it for a future client/project though so thanks for the idea!

cheers,

Offline

#95 2007-12-05 21:00:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_random_banner: Random banner image for advertising

Anton wrote:

I made a slight modification for when the alt text contains a <script> tag, refering to banners hosted elsewhere, and also using the caption field to keep track of impressions (a URL to an empty image is stored there).

Cool, I never thought of that, having not really considered it for this kind of “pro” application. I suppose it does make sense to be able to offer paid-for banners. I’ll give it some thought. Might even spawn a spin-off plugin if this one can’t manage it neatly.

Would you please email me the code changes. I’ll have a look and see if it’s the sort of thing that could be expanded and built into the next official release. And if you have any links about how this sort of thing is traditionally used and how referer tracking and stuff like this happens in the real world, it’d be most appreciated. Affiliate tracking and the like is a dark art to me :-)

Many thanks.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#96 2007-12-05 21:35:46

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: smd_random_banner: Random banner image for advertising

Oh, the hacks I made aren’t nearly as sofisticated as I would’ve liked, I’m not a PHP wizard ;)

But in essence: On line 460, check or if the field contains a <script> tag, e.g. using if (preg_match("/<script/i", $linkurl)) or similar, and just output the field value if there’s a match. (I also made a str_replace("&","&amp;",$refertxt); here for validations sake, feel free to do this elsewhere.)

Right after that, check similarly for a URL in the caption, e.g. if (preg_match("/http:/i", $row['caption'])) and add a minimalistic image right after the banner: $outStr .= '<img src="' .$referimg. '" border="0" width="1" height="1" />.

There’s no more black art than that, I’m afraid :) Fact is, the whole “adosphere” (is there a word for that?) is scaringly hacky, with document.write(), validation errors, browser sniffing and other obtrusive scripting dating back to last century all over the place..

Offline

#97 2007-12-30 19:13:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_random_banner: Random banner image for advertising

One more minor update. This time to add static image support to the files mode :-s Yes, it does sound backwards, but sometimes it’s useful to be able to put in banner placeholders or simply non-moving banners instead of whizzy flash ones.

So now, instead of having to use two random_banner calls or being limited to having either images OR files, there’s a dedicated Image mime type for handling jpg, png, gif and tiff images in file mode. Essentially all it does is output a standard HTML <img> tag instead of using <object>. Outputting an object tag for an image is possible but it’s yukky and badly supported cross-browser (there’s a surprise).

v0.34 is the official attempt at this, so take it away and break it. Though not essential, an update to smd_lib is supplied in the zip package.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#98 2008-01-06 09:32:36

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: smd_random_banner: Random banner image for advertising

Stef, I’m getting “Badly formed or empty plugin code” on smd_random_banner_v0.34. smd_lib and the older version installs fine.

Offline

#99 2008-01-06 11:00:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_random_banner: Random banner image for advertising

jm wrote:

Stef, I’m getting “Badly formed or empty plugin code”

Try the compressed plugin


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#100 2008-01-06 11:53:14

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: smd_random_banner: Random banner image for advertising

Problem solved! Thanks!

Offline

#101 2008-01-28 13:50:45

amyng
Member
Registered: 2007-01-05
Posts: 55

Re: smd_random_banner: Random banner image for advertising

Hi Bloke,

I’m having some trouble understanding the referrer tracking. I checked my logs and nothing shows (they show my IP address, but nothing shows if I’ve been clicking onto the random images). There’s no link in the Page entry nor Referrer.

Is this normal? If yes then how do I track how many clicks did my banner ads receive?

Thanks,
Amy

Offline

#102 2008-01-28 14:49:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_random_banner: Random banner image for advertising

amyng wrote:

I’m having some trouble understanding the referrer tracking… There’s no link in the Page entry nor Referrer.

Hi Amy, that’s weird it works here. I assume you’ve set up the link_in option to use alt or caption and put a URL in the alt/caption of the images you want to be clickable. So let’s run through a few checks:

  1. When you hover over a banner image, what do you see as the link? Does it show a correct URL to a valid article (TXP doesn’t log clicks to 404 pages) and does it have ?bid=ID_number on the end (?bid might be something else if you changed it with the referer attribute of course)
  2. Is the URL a local link to the same site? If it’s an external link to another site you’ll only see the click as a ‘referrer’ in the destination site

The system’s not foolproof and it’s only a rough guide to allow you to see how effective certain adverts are; as long as the link is a local link to your site it should show up in the Txp logs under the Page column. At least, that’s the theory.

I admit it’s not particularly friendly at the moment; the only way of really getting useful info out of it is to dump the logs out to a file and use some filtering software (even Excel!) to slice and dice the data. I believe Marios (or someone else, I forget…) was working on a companion plugin to enhance the log screen and make the output more usable. Not sure how far that went.

If you think the plugin is still behaving weirdly after checking the above, let me know some more detail about your setup; how your image links are set up, the URL of a page that’s misbehaving, your random_banner tag options, etc (via e-mail if your site’s not ready to go live) and I’ll see if I can work out what’s going wrong.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#103 2008-02-01 17:32:36

amyng
Member
Registered: 2007-01-05
Posts: 55

Re: smd_random_banner: Random banner image for advertising

Hi Bloke,

Thanks for the very swift reply!

** Quote:

2. Is the URL a local link to the same site? If it’s an external link to another site you’ll only see the click as a ‘referrer’ in the destination site **

Oh, no wonder! It’s linked to an outgoing site, so probably only the person’s website will see it as a referrer link.

I’m thinking of putting the Google Analytics code snippet so that I can track the clicks the ads will collect; see here and here

Do you think it’ll work?

Amy

Offline

#104 2008-02-01 19:52:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_random_banner: Random banner image for advertising

amyng wrote:

I’m thinking of putting the Google Analytics code snippet so that I can track the clicks the ads will collect; Do you think it’ll work?

No reason why not. I think it’ll work just fine.

I’ve not really looked at it much; I briefly delved into it when I kinda half considered encompassing something like this into random banner (after Anton had some success) but it would require me to sit down and think about how best to implement it. I figured with the amount of effort required and the multitude of ways of doing it (probably wrongly!), the easiest thing to do in situations such as yours is use a third party tracker.

fwiw, I’m not much of a fan of ad tracking or Google Analytics because pages invariably seem to be waiting for it which — to me at least — imposes a negative impact on the user experience for very little business gain. But some places absolutely insist on it; bizarre.

And the number of sites I’ve seen with the javascript error “urchinTracker is not defined” is unreal…

Last edited by Bloke (2008-02-01 19:55:55)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#105 2008-02-12 22:21:18

fowler
Member
Registered: 2007-02-12
Posts: 79

Re: smd_random_banner: Random banner image for advertising

on the most current release, i’m getting a “badly formed” error…

Offline

Board footer

Powered by FluxBB