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

detail_page.cgi to static detailed page

Quote Reply
detail_page.cgi to static detailed page
How do I use the Detailed_page plug-in to count detailed page impressions and still land users on the static detailed page after they clicked on a link, not the dynamic version.

Using <A href="<%db_cgi_url%>/detail_page.cgi?ID=<%ID%>">Detail Page Exists</A> as suggested in the plug-in help file will bring up a dynamic detailed page.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Hi,

I'm not sure why you'd want to do that, as the overhead is *really* in calling detail_page.cgi not having it actually output the template. At that point, it's pretty low additional overhead. To count the impressions the program has to verify the link record exists, write to the database, and then redirect you to another page.

To get the program to direct to a static page, you need to make a minor change to it, just bypass the call to SiteHTML to print out the template, and direct to the detail_page_url/<%ID%>.html or similar code. Can't access my files here, but it should be that simple.

But *again* by the time you call detail_page.cgi with an ID number, you might as well let it print out the dynamic page. If you do not want the resulting pages to be dynamic, just pass in d=0 I'm pretty sure I handled this correctly d=1/d=0 per a previous request a number of months ago.

My point in writing detail_page.cgi was to allow dynamic detail pages in a static site, to cut build time, and storage space for little used detail pages.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] detail_page.cgi to static detailed page In reply to
Pugdog,

Thanks for the reply. My purpose for using detail_page.cgi is not because I need dynamic detailed pages, it's simply because I need to count how many times a detailed page has been viewed.

Is there and easier way to do that than though using this plug-in? is that what you started explaining here:
Quote:
To get the program to direct to a static page, you need to make a minor change to it, just bypass the call to SiteHTML to print out the template, and direct to the detail_page_url/<%ID%>.html or similar code. Can't access my files here, but it should be that simple.

I have some links that point to detailed pages and some that point to external documents (on other sites).

Why static, detailed pages? I use LinksSQL to publish articles (a knowledge management system) and I'd like those pages to be indexed by internet robots without me having to do a bunch of rewrite rules.

Safe swoops
Sangiro

Last edited by:

sangiro: Aug 20, 2003, 10:07 PM
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
You could put an SSI on the detailed pages. The include would simply call a script that does the counting.

Or, you could analyze your logfiles.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Hi,

for what you want, yogi's SSI suggestion is probably better.

By using detailed_page.cgi you are still telling the robots the page is dynamic, even though it's served staticly.

You could use detailed_page.cgi as a blind ssi call, perhaps, cutting out all the display routines, and just keepiing the "select" (for link validity) and the "update" for counting routine. Return a space (essentially a nothing) to the SSI, and everyone will (should) be happy.

When you write out the page, just use ssi to call the detail_page.cgi?ID=<%ID%> and you'll be set up. *BUT* don't forget to edit out the display routines or you'll redirect to the dynamic page.

If I have a chance, later, I'll see if I can come up with the modified CGI file to just count hits to the detailed page.

You will need to use SSI, since you have to have some "active" or executable trigger.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [yogi] detail_page.cgi to static detailed page In reply to
I'm still looking for a clean solution for this. I'm simply looking for something that will count how many times a static detailed page has been viewed. An SSI as Ivan suggested will probably do. Would obviously like to track it in my Links database and not use of of the many flat file counters out there.

Anyone have something like this?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Have you tried using SiteStats for this?
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
In Reply To:
Have you tried using SiteStats for this?

Laura,

I have to admit I gave up on SiteStats here for a while. Blush Just found it too hard to get it to do what I need. I think I'll go back print out all the information I have and maybe give it another go...

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Try putting this on your static detailed page:

<!-- CODE_START -->
<script language="javascript">
var Title = '<%Title%>';
var GroupType = 'Links';
var GroupID = '<%ID%>';
var Counter = '';
</script>
<script language="javascript" src="<%build_root_url%>/count.js"></script>
<noscript>
<img src='<%db_cgi_url%>/sitestats.cgi?Title=<%Title%>&GroupType=Links&GroupID=<%ID%>&Counter=' border='0' alt='Hit Counter' width=1 height=1>
</noscript>
<!-- CODE_END -->
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Laura,

Here's what I currently have in the footer on all my pages:

Code:
<!-- CODE_START -->
<script language="javascript">
var Title = '<%if Title%><%Title%><%else%><%site_title%><%endif%>';
var GroupType = '<%if category_id%>Category<%endif%>';
var GroupID = '<%if category_id%><%category_id%><%endif%>';
var Counter = '';
</script>
<script language="javascript" src="<%build_root_url%>/count.js"></script>
<noscript>
<img src='<%db_cgi_url%>/sitestats.cgi?Title=<%if Title%>Title<%else%><%site_title%><%endif%>&GroupType=<%if category_id%>Category<%endif%>&GroupID=<%if category_id%><%category_id%><%endif%>&Counter=' border='0' alt='Hit Counter' width=1 height=1>
</noscript>
<!-- CODE_END -->

Looks pretty similar to yours. I'm assuming number of page views are logged in the SSCount table in the DB. Is that correct? Do the values in that table represent the total number of views since the link was first posted or does it reset?

I'm asking because I have pages that I can find in the DB and the count in the TotalViews field is significantly lower than reported by the detailed_page plugin.

Also, is there a delay before data starts appearing? I posted an article to my home page yesterday. I can see from the detailed_page plugin that it has been viewed more than 800 times already but I can't seem to find an entry for it in the SSCount table at all...

I pretty sure your plugin wil be able to do what I want - just need to get comfortable with how it works.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
You've got me worried now.

I've reset all my detailed hits to zero and emptied my SiteStats tables and I'm going to leave it running for a few hours and see what the discrepancy is like on my site.
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Hey Laura,

Just so you know I'm more than willing to accept that I may be doing something wacky here. Wink

Here's some more info for you to work with. Attached are 3 screen grabs.

main_page.jpg shows two articles on my home page. I added the ID's of each of those for you in red. I also circled the number of views as reported by the detailed_page plugin.

I went to the SSCount table and pulled up both ID 72 and 71 (from the main page) for you. You can see the number of total views logged.

Also, the code below is the SiteStats code for article 72 as it looks when I view the source of the page.

Hope this helps. Let me know if there's anything else I can help with.

Code:
<!-- CODE_START -->
<script language="javascript">
var Title = 'Starting a FUN 4-Way Team';
var GroupType = '';
var GroupID = '';
var Counter = '';
</script>
<script language="javascript" src="http://www.dropzone.com/count.js"></script>
<noscript>
<img src='http://www.dropzone.com/cgi-bin/safety/sitestats.cgi?Title=Title&GroupType=&GroupID=&Counter=' border='0'
alt='Hit Counter' width=1 height=1>
</noscript>
<!-- CODE_END -->

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Well my stats seem to be reasonably consistent. I think the differences may be that detail page gets incremented as soon as it is requested whereas SiteStats only gets incremented when the whole page is viewed - so if you double click on refresh, for example, without waiting for the page to load, detailed page goes up 2 but SiteStats only goes up 1.

So after deciding that the plugin seems to be behaving correctly on my site, why is it not working on yours? Well, I think that the answer might be that http://www.dropzone.com/count.js doesn't exist? So the few increments you are getting must be from people who do not have javascript enabled.

It may be that the file didn't get extracted properly from the plugin or that it is in a different place? The plugin should put it in build_root_path and the code uses <%build_root_url%>/count.js which should work - but maybe not in your setup?

Laura.
The UK High Street
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Quote:
It may be that the file didn't get extracted properly from the plugin or that it is in a different place? The plugin should put it in build_root_path and the code uses <%build_root_url%>/count.js which should work - but maybe not in your setup?

Yup - that's it! I've changed my build_root_path after this plugin were installed. I've copied that file into the appropriate spot. I'll see what it does now.

Laura - still not sure. Will the TotalViews in this column keep accumulating ad infinitum? Tongue

Safe swoops
Sangiro

Last edited by:

sangiro: May 16, 2004, 7:45 AM
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
In Reply To:
Laura - still not sure. Will the TotalViews in this column keep accumulating ad infinitum?[/quote]

Yes, that table keeps total counts. The other tables give you the daily and monthly figures.

I'm just about to put out a new release of the plugin which removes the graphic counter (no-one seemed to like it and it had problems on some browsers) and allows you to use a tag as a counter instead, which you can put anywhere on the page.

I do recommend that you slightly modify your code (this is the code I'll put in the new version of the plugin as I think it is slightly easier to understand):

<!-- CODE_START -->
<script language="javascript">
var Title = '<%if Title%><%Title%><%else%><%site_title%><%endif%>';
var GroupType = '<%if GroupType%><%GroupType%><%endif%>';
var GroupID = '<%if GroupType%><%ID%><%endif%>';
var Counter = '';
</script>
<script language="javascript" src="<%build_root_url%>/count.js"></script>
<noscript>
<img src='<%db_cgi_url%>/sitestats.cgi?Title=<%if Title%><%Title%><%else%><%site_title%><%endif%>&GroupType=<%if GroupType%><%GroupType%><%endif%>&GroupID=<%if GroupType%><%ID%><%endif%>&Counter=' border='0' alt='Hit Counter' width=1 height=1>
</noscript>
<!-- CODE_END -->


Then on your articles pages you can put <%set GroupType=Articles%> and on your detail pages <%set GroupType=Links%> and on your reviews pages <%set GroupType=Reviews%> and on your Category pages <%set GroupType=Category%>, etc. somewhere above the footer. (Can be used on any page which has an ID associated with it).

This will enable you in the future to print out lists of the most popular Categories, Reviews, etc.

Last edited by:

afinlr: May 16, 2004, 8:14 AM
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Quote:
Then on your articles pages you can put <%set GroupType=Articles%> and on your detail pages <%set GroupType=Links%> and on your reviews pages <%set GroupType=Reviews%> and on your Category pages <%set GroupType=Category%>, etc. somewhere above the footer. (Can be used on any page which has an ID associated with it).

Thanks Laura, I'll use the new code. Just to confirm which tag goes on which template:

<%set GroupType=Links%> = detail.html
<%set GroupType=Category%> = category.html
<%set GroupType=Reviews%> = review_search_results.html
<%set GroupType=Articles%> = ??

Not sure what my article pages would be in this case. My articles are displayed on the detail.html template. When you refer to "article pages" above are you talking about the home.html template?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Yes those are fine - I wasn't sure whether your articles were actually the detailed pages or something extra.

You may want to think a bit more about the review_search_results template - obviously you can group pages however you want. If you put this tag

<%set GroupType=Reviews%>

straight into this template then you will have some results which are for the review owner rather than the reviews of a link. You may want to separate these into two separate groups or just collect stats for reviews of a link. For example:

<%if ID%><%set GroupType=Reviews%><%endif%>

If you don't put it in an 'if statement' you will need to alter the code slightly so that the GroupID can be <%ID%> or <%user%>:

var GroupID = '<%if GroupType%><%if ID%><%ID%><%elsif user%><%user%><%endif%>';

I know that this is complicated but it does mean that you can choose exactly how you group the pages.
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Laura,

Which tag should I use to display the value from the TotalViews field on a page? I'd like to start tracking this next to the detailed views page and then move over with time.

Safe swoops
Sangiro

Last edited by:

sangiro: May 18, 2004, 8:14 AM
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Hi,

I've just uploaded the new version of the plugin which has the counters as tags.

Laura.
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Sweet! I'll check it out. Smile

Safe swoops
Sangiro
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Laura,

I like some of the new changes you've made. This is still the big one for me:

Quote:
All pageviews for a page: <%PageTotal('URL')%>
You need to replace URL with the actual URL of the viewed page - I haven't found a way to generate this yet for static pages.

Most of this exercise (as you've probably figured out) is me trying to get my articles on static pages to lighten my server load and still be able to count the number of views.

I tried to build the URL value using <%build_detail_url%>/<%ID%>.html. I'm sure you tried that too. Obviously the one tag inside the other breaks it...

I'll need to figure out a way to build the URL to make this work for me.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
If I were you I would use the tag:

<%GpTotal('Links',$ID)%>

If you have set the GroupType as Links on the detail page, this will count the views of both static and dynamic pages without making a distinction between them.

If you really want to use the url counter, I think you would need to use something like this:

<%set urltag=$build_detail_url%>
<%set urltag.="/"%>
<%set urltag.=$ID%>
<%PageTotal($urltag)%>

There may be a more straightforward way to do this but I think that should work.
Quote Reply
Re: [afinlr] detail_page.cgi to static detailed page In reply to
Using GpTotal should be fine for me.

My detailed pages have this before the footer:
<%set GroupType=Articles%>

My counter call is:
<%GpTotal('Articles',$ID)%>

And I get error:
Error: Variable 'GpTotal' is not a code reference

I have version 1.1.0 installed.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] detail_page.cgi to static detailed page In reply to
Blush
Sorry, try <%Plugins::SiteStats::GpTotal('Articles',$ID)%>

I'll fix that up in the tags info.