4D v16.3

WEB GET STATISTICS

Home

 
4D v16.3
WEB GET STATISTICS

WEB GET STATISTICS 


 

WEB GET STATISTICS ( pages ; hits ; usage ) 
Parameter Type   Description
pages  Text array in Names of the most consulted pages
hits  Longint array in Number of hits for each page
usage  Longint in Percentage of the cache used

The WEB GET STATISTICS command lets you get information about the most consulted pages loaded in the Web server’s cache. Consequently, these statistics only concern static pages, GIF pictures, JPEG pictures <100 KB and style sheets (.css).

Note: For more information about setting the 4D Web server’s cache, refer to the Web Server Settings section.

The command fills the pages Text array with the names of the most consulted pages. The hits Longint array receives the number of “hits” for each page. The usage parameter receives the percentage of the Web cache used by each page.

Example  

Let’s assume that you want to generate a semi-dynamic page that displays the statistics of the Web cache. For this, in a static HTML page named “stats.shtm” (pages suffixed .shtm are automatically parsed by the Web server), you place the tag  <!––#4DSCRIPT/STATS––> as well as references to the vPages and vUsage variables, for example: 

<html>
<head><title>4D Web Stats</title></head>
<!--#4DSCRIPT/STATS-->
<body>
<strong>Percentage of cache used: </strong>
<!--#4DTEXT vUsage-->
<hr>
<strong>Pages consulted most often: </strong>
<!--#4DHTML vPages-->
</body>
</html>

In the project method STATS, you write the following code:

 C_TEXT($1)
 C_TEXT(vPages)
 ARRAY TEXT(pages;0)
 ARRAY LONGINT(hits;0)
 C_LONGINT(vUsage)
 
 WEB CACHE STATISTICS(pages;hits;vUsage)
 For($i;1;Size of array(pages))
    \\For each page present in the cache
    vPages:=pages{$i}+"   "+String(hits{$i})+"<br>"
    \\Insert the name of the page and the HTML code
 End for

You can send the "stats.shtm" page using a URL link or using the WEB SEND FILE command.



See also 

Information about the Web Site
Web Server Settings

 
PROPERTIES 

Product: 4D
Theme: Web Server
Number: 658

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v6.5
Renamed: 4D v13

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)