Forum for users of JoomlaWatch / ExtraWatch for Joomla, Wordpress, Drupal, Magento, Prestashop

JoomlaWatch / ExtraWatch has following features: live real-time visitor statistics, location of your visitors on a map, blocking of users based on bad word list, front-end counters, click heat map, definition of goals and rules, graphs, directory size monitoring, monitoring of increase of database data in time, nightly email reports, interactive HTML5 chart of traffic flow within your website, SEO report with keyword statistics and keyword position trends

Welcome, Guest
Please Login or Register.    Lost Password?

Keywords per visit
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Keywords per visit
Keywords per visit 6 Years, 8 Months ago Karma: 0
(this is a repost of my previous topic, disappear after forum update)

I like to see keywords per visit near the "came from", ok you can pass your mouse on url and try to read it but i'm lazy.
I'm not a good programmer but I have done some mod and it's working fine so others can use it, and I hope you will improve and put in next version.

I also notice a problem with URL containing htmlspecialchars, it's happen sometimes

Here is the code (for v1.2.9) :
The idea is to detect keyword and put it at the start of the line, we use Google url rules as general : q=keywords

1) in components/com_joomlawatch/class.joomlawatch.helper.php
Find line 146

function truncate($str, $len = ""«») {

Add before

function truncateUrl($str, $len) {
if (strlen($str)+$len < 120)
return $str;
return substr($str, 0, 120-$len) . "...";

(120 is line lenght, good for 1024x800 window, adapt it to your needs)

2) in components/com_joomlawatch/class.joomlawatch.html.php
Find line 443 to 446

if (@ $row->referer) {
$refererTruncated = $this->joomlaWatch->helper->truncate($row->referer);
$output .= "<i style='color: gray;'> " . _JW_VISITS_CAME_FROM . ": <a href='$row->referer' target='_blank' style='color: gray;' title='$row->referer'>$refererTruncated</a></i>";

Replace by

if (@ $row->referer) {
$output .= "</td><tr><td colspan=8>"; // use all columns

$refererTruncated = str_replace('?', '&', $row->referer); // to prevent url starting with search?q= because we use '&q=' to detect keywords

// Some others search engines don't use 'q=' so we convert it (add yours)
$refererTruncated = str_replace('_nkw=', 'q=', $refererTruncated); // Ebay
$refererTruncated = str_replace('rdata=', 'q=', $refererTruncated); // Voila
$refererTruncated = str_replace('keyword=', 'q=', $refererTruncated);

// We write in blue an engine short name (add yours) with a code for later split
$refererTruncated = str_replace('', '<font color=blue>GoogleCOM</font> {sp}', $refererTruncated);
$refererTruncated = str_replace('', '<font color=blue>GoogleFR</font> {sp}', $refererTruncated);
$refererTruncated = str_replace('', '<font color=blue>EbayFR</font> {sp}', $refererTruncated);

// No we are ready to separate keywords
$refererTruncated = explode('&', $refererTruncated);
foreach ($refererTruncated as $rtvalue) {
if (substr($rtvalue, 0, 2) == 'q=')
$rtq = str_replace('q=', '', $rtvalue);
$rtr .= $rtvalue.'&';
if ($rtq=='') $rtq='---'; // if no keyword
if (strpos($rtr, '{sp}')===false) $rtr='{sp}'.$rtr; // if no engine short name
$refererTruncated = "<b>".rawurldecode($rtq)."</b> " . _JW_VISITS_CAME_FROM . ": " . $rtr; // we construct the line
list ($rtq, $rtr) = split ('{sp}',$refererTruncated); // keep formatting things away (as blue engine name)
$rtr = htmlspecialchars_decode($rtr); // don't count specials char in strlen
$rtr = $this->joomlaWatch->helper->truncateUrl($rtr, strlen($rtq)); // reduce to line length
$refererTruncated = $rtq . htmlspecialchars($rtr); // rebuild the line
unset($rtq,$rtr); // empty var for next row

$output .= "<i style='color: gray;'><a href='$row->referer' target='_blank' style='color: gray;' title='$row->referer'>refererTruncated</a></i>";

Done ! Enjoy

expected result :
Pax24 (User)
Fresh Boarder
Posts: 4
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
Re:Keywords per visit 6 Years, 8 Months ago Karma: 0
I can't find this:

function truncate($str, $len = ""«») {

At line 146 I have:

function truncate($str, $len = "") {
if (@ !$len)
$len = $this->config->getConfigValue('JOOMLAWATCH_TRUNCATE_VISITS');

if (strlen($str) < $len)
return $str;
return substr($str, 0, $len) . "...";

I too have 1.2.9
ElimGarak (User)
Fresh Boarder
Posts: 11
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
Go to topPage: 1

Latest News

Get the latest freelance project announcements

Download ExtraWatch™

ExtraWatch™ FREE is Joomla, Wordpress, Prestashop, Magento plugin with following features: Live Stats, Nightly Email Reports, Goals, Graphs, Anti-spam, History and more