Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[New Plugin] Count_Impressions

(Page 1 of 2)
> >
Quote Reply
[New Plugin] Count_Impressions
Ok, it may sound silly for a plugin, but some people did want it...so I thought I would make it Smile

Basically, what this plugin does is track how many times a link has been displayed on any page within Links SQL. The actual functionality of the plugin will only work in dynamic mode (i.e page.cgi, search.cgi, etc)....but there is a file in there that SHOULD track via an IFRAME (you will need to know how to do this yourself, as it is not a main feature yet, I just added it in for people who wanted to play with it).

The admin side of it is PHP, so if you can't run PHP scripts from within your cgi-bin, then this may not be any good for you. I'm gonna work on a Perl version of the admin, but it may take me a little while to get used to the in's and outs of Link SQL Wink

Well, all that is left to say is, ejoy Smile

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
Hmm why use an iframe?

You could just use a global ;)

sub { $DB->table('Table')->update( { HitCount => \'HitCount + 1' }, { LinkID => $_[0] } ) }

Thats all you need. (Well something along those lines)

Then you'd put the tag into link.html ....may be a bit slow though doing 25+ updates per page...eww...you might want to consider using something like:

UPDATE Table SET HitCount = HitCount + 1 WHERE LinkID IN ('1','2','3')

...or whatever.

Last edited by:

Paul: May 1, 2002, 10:03 AM
Quote Reply
Re: [Paul] [New Plugin] Count_Impressions In reply to
Quote:
You could just use a global ;)

Erm, it already is. If you had read the 'how-to' on it, then you would realise there already was a global ;) I was saying that you COULD use an IFRAME (i.e. it is experimental).

Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
Yeah but you have it as a plugin, what I was saying was that you only needed a one line global, not really worthy of a plugin, but thats up to you.

The admin backend probably makes it worthy of being turned into a plugin.

Last edited by:

Paul: May 1, 2002, 10:44 AM
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
You have a typo in the install message:

Will ONLY wokr in dynamic mode at the moment

Also this bit is wrong:

unlink "$CFG->{admin_root_path}/settings.inc.php" if -d "$CFG->{admin_root_path}/settings.inc.php";

-d is checking for a directory.

Last edited by:

Paul: May 1, 2002, 10:54 AM
Quote Reply
Re: [Paul] [New Plugin] Count_Impressions In reply to
Ooops...thanks for those. I've fixed 'em up. Man my typing sucks today!

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
Hi Andy,

Good start! A good idea to improve performance would be to move the global tag from link.html, to each template where links are used: category.html, search_results.html, new.html, cool.html.

Then modify your global so it grabs all the link ids that are displayed on that page, and do a single update:

my @ids = (1, 2, 3, 4);
$DB->table('Links')->update( { ShowCount => \'ShowCount + 1' }, { ID => \@ids });

That gets translated to:

UPDATE Links SET ShowCount = ShowCount + 1 WHERE ID IN (1,2,3,4)

You can generate the list of ID's by accessing the loop variable on the template. Do a <%GT::Template::dump%> to see which one it is.

This will dramatically improve the performance of the plugin.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] [New Plugin] Count_Impressions In reply to
I'd love to...havn't got the time at the moment though. Got a big push for coursework..I just wanted to get this done, and out of the way...I hate having things you want to do stuck in the back of your mind Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
>>
I just wanted to get this done, and out of the way...I hate having things you want to do stuck in the back of your mind
<<

Ewww....thats not the attitude....you may hate it being stuck in the back of your mind but these are peoples sites and businesses you are playing with....25 queries per page vs 1 could lose those businesses money.
Quote Reply
Re: [Paul] [New Plugin] Count_Impressions In reply to
Yeah..but if I don't get this coursework done by the end of next week, I have screwed up 2 years of being at college...which IMO, is more important. Especially as this plugin is a freebie Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
Thats correct but didn't you know the exams were coming or something?....if they were that important how come you started the plugin the other day Cool

Last edited by:

Paul: May 1, 2002, 11:51 AM
Quote Reply
Re: [Paul] [New Plugin] Count_Impressions In reply to
Because I wanted to experiment with Plugins. I thought we still had 4 weeks to get it done, but aparantly its the 10th of may now :( So, as you can imagine, I'm in a bit of a frantic rush to get it all done now. The plugin thing was virtually done, so I thought I would get a working one available, and then when I find some free time, modify it to adopt the idea that you/alex provided Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Paul] [New Plugin] Count_Impressions In reply to
Quote:
you may hate it being stuck in the back of your mind but these are peoples sites and businesses you are playing with....25 queries per page vs 1 could lose those businesses money.
I don't aggree you. If somebody use a free plugin, then he must assume the responsibility for his installation. Those who are doing real business, if wants support & faster updates should think about a paid plugin.

Don't misunderstand me, I don't force paid plugins. But note, you can not criticize somebody, if he does something in his free time, releases this job for the public, then he is not updating or correcting the plugin. There is no obligation to use a plugin. But you can choose to use for your own responsibility.
But that's only my personal opinion.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] [New Plugin] Count_Impressions In reply to
>>
But note, you can not criticize somebody, if he does something in his free time, releases this job for the public, then he is not updating or correcting the plugin.
<<

That is totally wrong (but in any case I never criticized the fact that he made a free plugin in his spare time...Im criticizing what he said above).

If you are going to make a plugin and release it for people to use on their business related sites you should be prepared to at least give a minimal amount of support and fix bugs....even if it is free.....and especially as it may affect Gossamer-Threads. If GT clients get hold of faulty plugins not only will the author get some abuse but GT will too no doubt.

If you are just going to bang out loads of faulty plugins and then when people complain you just say, "Sorry its free so tough" then you'll probably find you have a whole heap of complaints or no-one will use your plugins so you may as well not have made them in the first place.

Ugh as a plugin developer yourself, to say it is ok to not fix bugs and give no support is bad.

If you don't think you can provide support or fix bugs then don't make the plugin in the first place...simple.

This post isn't directed at Andy, it's just a general rant.

Last edited by:

Paul: May 2, 2002, 1:10 AM
Quote Reply
Re: [Paul] [New Plugin] Count_Impressions In reply to
Paul, I didn't say I was never going to update it. I just said I wasn't going to be adding that extra functions for the next couple of weeks. There is no problem with the plugin for smaller sites, but as you say, those with large sites may find a strain on MySQL (or whatever they are using).

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
I wasn't directing that post at you as I mentioned at the end. I wrote it about 5 seconds after waking up and wasn't in my usual happy mood :)

Last edited by:

Paul: May 2, 2002, 3:19 AM
Quote Reply
Re: [Alex] [New Plugin] Count_Impressions In reply to
Mmm..just thought I would have a look at how to do this.

You said to put all the ID's in a loop, and then run the update query that way. However, how would I get them in an array like;

>>>my @ids = (1, 2, 3, 4); <<<

I'm assuming I need to use the link_loop data (not sure where its stored though). Hopefully I could work the rest out after that Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Paul] [New Plugin] Count_Impressions - Plugin certification In reply to
Paul,

I aggree you, partially.

Quote:
even if it is free.....and especially as it may affect Gossamer-Threads.
If GT clients get hold of faulty plugins not only will the author get some abuse but GT will too no doubt.
Plugins should not make bad reputation of GT scripts. Yes, this is true, I aggree with this.

BUT. I show you an example, which shows correctly the position & problem of GT scripts (LSQL & GForum) plugins:
Example:
Just imagine the Windows. Windows has drivers. Drivers mostly are written by third party hardware manufacturers.
1) Microsoft does not recommend third party drivers. Creators of third party drivers supports & corrects their own product as much they decide.
2) But there are Microsoft certified drivers, which have been tested for compatibility with Windows operating systems. For the best performance, Microsoft recommends Microsoft certified drivers for use with your hardware products...
3) Moreover, Microsoft signed drivers indicates, that the product was tested for compatibility with Windows and has been not altered since testing. This is especially recommended.

GT could follow similar way (that's my opinion & suggestion):
1) There could be tested (GT Certified) plugins, which are compatible with LSQL, and their authors are still now supporting & developing the plugins.
2) All other plugins are unsigned, untested plugins, so everybody use them for their own responsibility. Support & bug fixes depends on authors. Users could not await much support from developers of uncertified plugins, especially if they are free plugins.

Personally I will give support & fix bugs for my upcoming plugins, as it will be in the software licence. But if Andy says, the plugin is free and no support will be available for 3 weeks then he can do this. The user can decide to install the plugin, and if it is not working as wanted, the user is able to uninstall it. Nothing is obligatory to use. That's the freedom of users.

I would like to cut discussion now about support problem of Andy's plugin.
However I'm open to discuss advantages of GT Certified plugins.
I'm sure, Alex would have a few words to the discussion about GT Certified plugins. Wink

If the idea gets some echoes, I suggest to open a new thread for that subject.

Opinions are welcome.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
I installed this and it totally overwrote my template globals.
Quote Reply
Re: [webmaster33] [New Plugin] Count_Impressions - Plugin certification In reply to
I like the idea of a certified plug-in...... maybe any of the plugins in the official download area (right out of plugin manager in LSQL) could be considered as certified, or at least tested to be compatible with the current version of Links and then have a "GT Certified" placed in the licence or instructions.
Quote Reply
Re: [rayhne] [New Plugin] Count_Impressions In reply to
In Reply To:
I installed this and it totally overwrote my template globals.

Hi. That sounds very odd. I can't verify this myself, but the code Alex gave me for adding a global shouldn't do this. Are you sure it was done via the plugin? Maybe you could send me some information as to where I can view your problem?

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [webmaster33] [New Plugin] Count_Impressions In reply to
Thanks, W33, it's pretty much something that needs to be said every now and again.

All of us, except "Staff" do this in our "free" time, and for some of us, that gets crunched at times, for different reasons (personal, school, work, or hardware).

Since the "fixes" are posted in the thread, it can be left as an exercise to the user, if someone needed the "upgraded" version in a more timely fashion.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] [New Plugin] Count_Impressions In reply to
I'm glad that there are some people, who aggree with me.

What do you think about the GT Certified plugin idea?
Opinions? Ideas?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Alex] [New Plugin] Count_Impressions In reply to
Alex..any ideas on why the addition global code would cause it to overwrite Rayhne's globals.txt file? I'm stumped.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [New Plugin] Count_Impressions In reply to
I've already removed the plug and corrected the globals but, if you want, I can do it again so you can look it over. Since people are using my Directory, I don't want to keep it screwed up too long though.

I just re-installed the plug-in. Go here to see how it is now screwed up:

http://intranet.dnr.state.wi.us/...staffdir/reports.htm

What other info do you need? (BTW, I am still using a beta version of 2.1.0)
> >