Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About Statistics for GS Websites
#22
After testing with bbclone, i improve the bbclone analitics-code from @Felix with custom titles for my search.php- and tags.php pages.

First filter the search and tag terms from the url (i used the I18N Search-plugin)

search.php template:

Code:
<?php if (@$_REQUEST['words']) { // show search term(s) ?>
                  <h1 class="page-title">Zoekresultaten voor: <span>
                    <?php
                    // filter the SEARCH WORD from the url:
                    // YOUR_SITE.COM/search/?words=SEARCH_WORD&search=Zoeken
                    $search_word = htmlspecialchars($_REQUEST['words']); ?>
                    <?php echo $search_word; ?></span>
                </h1>
                <?php } ?>


tags.php template:

Code:
<?php if (@$_REQUEST['tags']) { // show tag ?>
                  <h1 class="page-title">Tag: <span>
                  <?php
                    // filter the TAG from the url:
                    // YOUR_SITE.COM/tags/?tags=TAG_NAME
                    $tag_name = htmlspecialchars($_REQUEST['tags']); ?>
                    <?php echo $tag_name; ?></span>
                </h1>
                <?php } ?>


Put the improved bbclone-code in the footer.inc.php:

Code:
<?php
  // BBCLONE Analytics
  $analytics_title = return_page_title(); // default title

  if ($template_file == 'tags.php') {
    // $tag_name = available at tags.php
    $analytics_title = "Tag: ".$tag_name;
  }
  else if ($template_file == 'search.php') {
    // $search_word = available at search.php
    $analytics_title = "Zoekresultaten voor: ".$search_word;
  }

  if (return_page_title()=='Oops! Page not found!') {
    // do nothing
  } else { // activate bbclone analytics script
  define("_BBC_PAGE_NAME", $analytics_title);
  define("_BBCLONE_DIR", "bbclone/");
  define("COUNTER", _BBCLONE_DIR."mark_page.php");
  if (is_readable(COUNTER)) include_once(COUNTER);
  }
?>


Without this code and using search- or tag results it shows only the page title: Search or Tags without the terms.
With this code it shows Search results for: SEARCH_WORD or Tag: TAG

If you wish test and see, go to my website and the statistics page , and click on a tag or using a search term.

Also thanks to @Felix for his code snippet ;-)


- USING VIEWS/HITS on a single page:
On a post-page you can also see the views per single page.

Adding this code-snippet in your_template.php-template:
Code:
<?php
                        //-------Display single page visits -----------
                        require("bbclone/var/access.php");
                        // number of hits by title
                        $single_page_hits = $access["page"][return_page_title()]["count"];
                        if (empty($single_page_hits)) {
                          // needed instead shows nothing
                          $single_page_hits = 0;
                        }
                        ?>


Show the views/hits on your page:
Code:
<?php echo $single_page_hits; ?>

Extra tip:
bbclone using the title as page-id.
If the title > 60 characters then it doesn't show the hits on your single post page correctly.
You can increase the characters in bbclone/conf/config.php, so you can see the hits on your single page correctly (for my needs a changed to 80:

Code:
// The max. number of characters for the page name.
// Longer page names will be stripped-down at the front, leading with "..."
// IMPORTED NOTE: This option changes how page names are recorded,
//                so you may need to reset the stats.
// Syntax:
// $BBC_MAX_PAGENAME = 60; => 60 characters (default)
$BBC_MAX_PAGENAME = 80;

Voila, thats my experience with bbclone until now :-)
Feel free using and customize all this code-snippets for your needs.

Hope can help someone improve his bbclone statistics.
Reply


Messages In This Thread
About Statistics for GS Websites - by Felix - 2020-07-24, 15:37:13
RE: About Statistics for GS Websites - by Felix - 2020-09-26, 00:10:20
RE: About Statistics for GS Websites - by Felix - 2020-09-26, 00:28:26
RE: About Statistics for GS Websites - by tuxy - 2023-02-04, 20:50:03
RE: About Statistics for GS Websites - by Felix - 2023-02-05, 04:37:47
RE: About Statistics for GS Websites - by tuxy - 2023-02-05, 20:40:41
RE: About Statistics for GS Websites - by Felix - 2023-02-06, 23:58:17
RE: About Statistics for GS Websites - by tuxy - 2023-02-08, 06:33:28
RE: About Statistics for GS Websites - by Felix - 2023-02-08, 07:05:02
RE: About Statistics for GS Websites - by tuxy - 2023-02-08, 07:40:09
RE: About Statistics for GS Websites - by Felix - 2023-02-08, 07:34:13
RE: About Statistics for GS Websites - by tuxy - 2023-02-08, 07:54:31
RE: About Statistics for GS Websites - by Felix - 2023-02-08, 08:14:13
RE: About Statistics for GS Websites - by tuxy - 2023-02-08, 08:21:59
RE: About Statistics for GS Websites - by tuxy - 2023-02-09, 09:23:48
RE: About Statistics for GS Websites - by Felix - 2023-02-09, 17:53:58
RE: About Statistics for GS Websites - by tuxy - 2023-02-09, 21:21:59
RE: About Statistics for GS Websites - by Felix - 2023-02-10, 01:10:56
RE: About Statistics for GS Websites - by mvlcek - 2023-02-10, 04:43:30
RE: About Statistics for GS Websites - by tuxy - 2023-02-10, 06:22:44
RE: About Statistics for GS Websites - by Felix - 2023-02-10, 08:08:52
RE: About Statistics for GS Websites - by tuxy - 2023-02-11, 20:41:16
RE: About Statistics for GS Websites - by Felix - 2023-02-11, 22:17:39
RE: About Statistics for GS Websites - by tuxy - 2023-02-12, 02:02:38



Users browsing this thread: 1 Guest(s)