<?xml version="1.0" encoding="iso-8859-1"?>
<!-- article-1.00.xml template -->
<?xml-stylesheet type="text/xsl" href="/lib/xsl/devedge-1.00/article_en.xsl"?>
<nde:article 
  url="/viewsource/2002/browser-statistics/"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:nde="http://devedge.netscape.com/2002/de" 
  xmlns:ent="http://devedge.netscape.com/2003/ent"
  xml:lang="en">

  <nde:header>
  <nde:title>Tracking Gecko Browser Statistics</nde:title>
  <nde:category>Technote</nde:category>
  <nde:authlist>
    <nde:author>
      <nde:authname>Bob Clary</nde:authname>
      <nde:authaffil>Netscape Communications</nde:authaffil>
    </nde:author>
  </nde:authlist>
  <nde:pubdate year="2002" month="12" day="16"/>
  <nde:moddate year="2003" month="01" day="30"/>
  <nde:channels>
   <nde:channel id="viewsource"/>
    <nde:channel id="gecko"/>
  </nde:channels>
  <nde:summary>
      Learn how to accurately track website visitors using 
      Netscape Gecko-based browsers.
  </nde:summary>
  <nde:abstract>
  </nde:abstract>
</nde:header>

  <nde:head>
    <meta name="description"
          content="Learn how to accurately track the number of website visitors using Netscape Gecko-based browsers." />

    <meta name="keywords"
      content="devedge, netscape, gecko, mozilla, browser detection, web site analytics, web logs, web traffic" />

  </nde:head>
  
  <nde:content>
    
    <p>
      Learn how to accurately track website visitors using 
      Netscape Gecko-based browsers.  For more information regarding detecting
      browsers related to content development, please see 
      <a href="/viewsource/2002/browser-detection/">Browser Detection and Cross Browser Support</a>.
    </p>

    <h2 id="background">Background</h2>

    <p>
      It is no longer a two-browser world (Navigator and Internet Explorer). Netscape Gecko<sup>TM</sup> 
      based browsers present a unique challenge for properly 
      reporting browser usage due the variety of browsers which use 
      <a href="/central/gecko/">Netscape Gecko</a> embeddable browser.
      If your web analytics software reports solely on Netscape 6.x and/or Netscape 7.x
      in web logs, you will miss the other
      browsers based upon Netscape Gecko such as Mozilla, CompuServe 7, AOL for Macintosh OS X,
      Galeon, Phoenix, Chimera and others.
    </p>

    <h2 id="server">Tracking Netscape Gecko Server Side</h2>

    <p>
      Tracking Netscape Gecko traffic on the server requires use of the user-agent string reported
      by the browser. 
      <a href="http://www.mozilla.org/build/revised-user-agent-strings.html">Mozilla user-agent strings</a>
      define the Netscape Gecko user-agent string format:
    </p>

    <pre>Mozilla/5.0 (Platform; Security; OS-or-CPU; Localization; rv:x.x.x) Gecko/CCYYMMDD Vendor/Version</pre>

    <p>
      Where
    </p>

  <ul>
    <li><code>Platform</code> describes the general class of operating system</li>
    <li><code>OS-or-CPU</code> describes the operating system in more detail</li>
    <li><code>Localization</code> describes the language of the user interface</li>
    <li><code>rv:x.x.x</code> describes the branch from which the browser was created 
      (this is also referred to as the Prerelease version in the mozilla.org user-agent 
      string reference).</li>
    <li><code>Gecko</code> is the signature of all Netscape Gecko browsers</li>
    <li><code>CCYYMMDD</code> is the date (e.g. 20021205) the browser was built</li>
    <li><code>Vendor</code> describes the vendor or brand. Note that for Mozilla, the Vendor is not
    present.</li>
    <li><code>Version</code> describes the Vendor's version number.</li>
  </ul>

  <p>
    The most important parts of the Gecko user-agent string for reporting browser statistics are:
  </p>

  <dl>
    <dt><code>Gecko</code></dt>
    <dd>
      <p>
        The string <code>Gecko</code> is the unique identifier for all Gecko
        based browsers. This is the single most important aspect of the user-agent
        string to detect in order to properly report Gecko usage.
      </p>
    </dd>
    <dt><code>rv</code></dt>
    <dd>
      <p>
        <code>rv</code> signifies which version of Netscape Gecko is being used 
        and  is the second most important aspect of the user-agent
        string to report for Gecko based browsers since
        each version of Gecko may be used by a variety of different browsers from different
        vendors.
      </p>
    </dd>
    <dt><code>Vendor/Version</code></dt>
    <dd>
      <p>
        The value of the <code>Vendor/Version</code> portion of the Gecko user-agent string
        is not specified by the Mozilla user-agent string reference and can be any value 
        determined by the organization responsible for creating each particular browser
        based upon Gecko. 
      </p>
      <p>
        Netscape branded browsers based upon Netscape Gecko will contain the string
        <code>Netscape</code> following the <code>Gecko/CCYYMMDD</code> portion of
        the user-agent string. For example, Netscape 6.x browsers will contain
        <code>Netscape6/6.x</code> following the <code>Gecko/CCYYMMDD</code> and
        Netscape 7.x browsers will contain <code>Netscape/7.x</code> following
        <code>Gecko/CCYYMMDD</code>.
      </p>
      <p>
        AOL-branded Gecko-based browsers based upon Netscape Gecko will contain the string
        <code>AOL</code> following the <code>Gecko/CCYMMDD</code> portion of the 
        user-agent string. For example, AOL agents based upon Netscape Gecko
        will contain <code>AOL/7.0</code> or <code>AOL/8.0</code> depending
        upon their version.
      </p>
      <p>
        CompuServe branded browsers based upon Netscape Gecko will contain the string
        <code>CS 2000 7.0</code> following the <code>Gecko/CCYMMDD</code> portion of the 
        user-agent string.
      </p>
      <p>
        See <a href="/viewsource/2002/gecko-useragent-strings/">
          Gecko User Agent Strings</a> for a list of Netscape/AOL released
        user-agents based upon Netscape Gecko.
      </p>
    </dd>
  </dl>

  <h3>Example</h3>

  <p>
    The following code fragment illustrates the process of detecting Netscape Gecko
    using Perl.
  </p>

<pre><![CDATA[
my $hittotal = 0;
my $geckototal = 0;
my $geckorv;
my $geckovendor;

while (<ARGV>)
{
  ++$hittotal;

  my ($rv, $gecko) = 
      $_ =~ /rv:([^); ]+).*(Gecko)\/[0-9]{8}/;

  if ($gecko)
  {
    my ($vendor, $version) = 
        $_ =~ /Gecko\/[0-9]{8} ([^\/"]+)\/([^" ]+)"/;

    if (!$vendor)
    {
      $vendor  = "Mozilla";
      $version = "$rv";
    }

    $vendorversion = "$vendor/$version";
    $vendorrv      = "$vendor/$rv";

    if (!$geckorv{$rv})
    {
      $geckorv{$rv} = 0;
    }

    if (!$geckovendor{$vendorversion})
    {
      $geckovendor{$vendorversion} = 0;
    }

    if (!$geckovendorrv{$vendorrv})
    {
      $geckovendorrv{$vendorrv} = 0;
    }

    $geckototal += 1;
    $geckorv{$rv} += 1;
    $geckovendor{$vendorversion} += 1;
    $geckovendorrv{$vendorrv} += 1;
  }
}

printf "%-20s = %9d\n", "total hits", $hittotal;
print "\n";

printf "%-20s = %9d\n", "total gecko hits", $geckototal;
print "\n";

print "gecko by rv\n";
foreach $x (sort keys %geckorv)
{
  printf "%-20s = %9d\n", $x, $geckorv{$x};
}
print "\n";

print "gecko by vendor/rv\n";
foreach $x (sort keys %geckovendorrv)
{
  printf "%-20s = %9d\n", $x, $geckovendorrv{$x};
}
print "\n";

print "gecko by vendor/version\n";
foreach $x (sort keys %geckovendor)
{
  printf "%-20s = %9d\n", $x, $geckovendor{$x};
}
]]>
</pre>

<p>
  The output of this perl script on recent DevEdge logs shows the variety of 
  user-agent strings which are possible with Gecko.  Note how the "gecko by rv"
  report and the "gecko by vendor/rv" report are more reliable than the 
  "gecko by vendor/version" due to the non-standard format used by some user agents.
</p>
<p>
  Note that commonly available browser
  statistics reporting programs under reported Gecko based browsers by over 5%
  on the same input.
</p>

<pre>
total hits           =  10799274

total gecko hits     =   3317791

gecko by rv
0.1                  =        51
0.9                  =       122
0.9.1                =       621
0.9.1+               =        13
0.9.2                =     26209
0.9.2+               =        10
0.9.2.1              =      3392
0.9.3                =       405
0.9.4                =    121583
0.9.4.1              =    186999
0.9.4.2              =      1382
0.9.5                =      1575
0.9.5+               =         2
0.9.6                =       673
0.9.6+               =       213
0.9.7                =       838
0.9.7+               =       190
0.9.8                =      7517
0.9.8+               =       757
0.9.9                =     13948
0.9.9+               =       331
1.0                  =       124
1.0.0                =    219419
1.0.0+               =      1354
1.0.1                =   1415067
1.0.2                =     55378
1.01                 =        15
1.0rc1               =      5011
1.0rc2               =     65893
1.0rc3               =      7714
1.1                  =    437016
1.1+                 =        10
1.1.0                =        34
1.1:                 =        40
1.1a                 =     12710
1.1a+                =      1245
1.1b                 =     82288
1.2                  =     40398
1.2.0                =         6
1.2.1                =     87679
1.2.x                =         2
1.2a                 =     79352
1.2a+                =        42
1.2b                 =    345416
1.2b+                =        36
1.2b-s               =         1
1.3a                 =     94473
1.97                 =        47
2.5.7                =        76
21.0.3               =         8
9.9.9                =         8
alpha                =        98

gecko by vendor/rv
AOL/1.0.1            =       444
AOL/1.0.2            =       198
AOL/1.0rc1           =         7
AOL/1.0rc3           =         4
AOL/1.1a             =         1
AOL/1.1b             =         1
Bayanihan/1.0.1      =        83
Beonex/1.0.1         =        88
CS 2000 7.0/0.9.4.2  =      1230
CS-Netscape6/0.9.2   =        10
CSIV-Netscape6/0.9.2 =        19
Chimera/1.0.1        =     50471
CyberSouls/1.1       =       204
Debian/0.9.9         =       183
Debian/1.0.0         =     23590
Debian/1.0.1         =       572
Debian/1.0rc1        =        85
Debian/1.0rc2        =        49
Debian/1.1           =     11992
Debian/1.1a          =        21
Debian/1.2           =      1927
Debian/1.2.1         =      1272
Debian/1.2b          =        11
E-kochanPower/1.0.1  =        13
Explorer/0.9.4       =        10
GLU/1.0.0            =         8
GLU/1.2.1            =        16
GLU/1.2a             =       123
GalionPublicLibrary/1.1 =        27
GalionPublicLibrary/1.2b =         7
IBM Web Browser for OS/1.0.1 =        30
K-Meleon/1.2b        =        45
Kent Pharmaceuticals Ltd/0.9.4.1 =        11
Kristof/0.9.5        =        16
Mozilla-Gumi/1.1     =        49
Mozilla/0.1          =        51
Mozilla/0.9          =       122
Mozilla/0.9.1        =       293
Mozilla/0.9.1+       =        13
Mozilla/0.9.2        =      2416
Mozilla/0.9.2+       =        10
Mozilla/0.9.2.1      =      3392
Mozilla/0.9.3        =       405
Mozilla/0.9.4        =      7532
Mozilla/0.9.4.1      =      4407
Mozilla/0.9.4.2      =       152
Mozilla/0.9.5        =      1559
Mozilla/0.9.5+       =         2
Mozilla/0.9.6        =       673
Mozilla/0.9.6+       =       213
Mozilla/0.9.7        =       838
Mozilla/0.9.7+       =       190
Mozilla/0.9.8        =      7517
Mozilla/0.9.8+       =       757
Mozilla/0.9.9        =     13765
Mozilla/0.9.9+       =       331
Mozilla/1.0          =       124
Mozilla/1.0.0        =    193546
Mozilla/1.0.0+       =      1354
Mozilla/1.0.1        =    148622
Mozilla/1.0.2        =      1404
Mozilla/1.0rc1       =      4896
Mozilla/1.0rc2       =      5594
Mozilla/1.0rc3       =      7618
Mozilla/1.1          =    416077
Mozilla/1.1+         =        10
Mozilla/1.1.0        =        10
Mozilla/1.1:         =        40
Mozilla/1.1a         =     12603
Mozilla/1.1a+        =      1234
Mozilla/1.1b         =     79391
Mozilla/1.2          =     38416
Mozilla/1.2.0        =         6
Mozilla/1.2.1        =     86150
Mozilla/1.2.x        =         2
Mozilla/1.2a         =     77475
Mozilla/1.2a+        =        42
Mozilla/1.2b         =    147100
Mozilla/1.2b+        =        36
Mozilla/1.2b-s       =         1
Mozilla/1.3a         =     30681
Mozilla/1.97         =        47
Mozilla/2.5.7        =        76
Mozilla/21.0.3       =         8
Mozilla/9.9.9        =         8
Mozilla/alpha        =        98
MultiZilla/1.0.0     =      1817
MultiZilla/1.0.1     =       978
MultiZilla/1.0.2     =       127
MultiZilla/1.0rc2    =        35
MultiZilla/1.0rc3    =        59
MultiZilla/1.1       =      8343
MultiZilla/1.1.0     =        22
MultiZilla/1.1a      =        85
MultiZilla/1.1b      =      2337
MultiZilla/1.2       =        55
MultiZilla/1.2.1     =       160
MultiZilla/1.2a      =      1234
MultiZilla/1.2b      =      2068
MultiZilla/1.3a      =        13
Netscape 6/1.0rc1    =        23
Netscape/1.0.0       =       386
Netscape/1.0.1       =   1213553
Netscape/1.0.2       =     53649
Netscape/1.0rc2      =     60203
Netscape/1.1         =        57
Netscape/1.1a+       =        11
Netscape/1.1b        =       302
Netscape/1.2a        =       453
Netscape/1.2b        =      3784
Netscape/1.3a        =      3914
Netscape6/0.9.1      =       328
Netscape6/0.9.2      =     23764
Netscape6/0.9.4      =    114041
Netscape6/0.9.4.1    =    182581
Netscape6/1.0.0      =        71
Netscape6/1.0.1      =       154
Netscape6/1.0rc2     =        12
Netscape6/1.0rc3     =        33
Netscape6/1.1        =       222
Netscape6/1.1.0      =         2
Netscape6/1.1b       =       257
Netscape6/1.2.1      =        64
Netscape6/1.2a       =        44
Netscape6/1.2b       =       133
Netscape6/1.3a       =        15
Netscape7/1.01       =        15
Pescadero/1.3a       =        53
Phoenix/1.2b         =    192268
Phoenix/1.3a         =     59797
PiTech/1.0.1         =         6
Smart WebGuide/1.1   =        10
Sylera/1.2.1         =        17
TCODEUTIWB20__000 IBM Web Browser for OS/1.0.1 =         1
TCODEUTIWB20__001 IBM Web Browser for OS/1.0.1 =        52
WebWasher/1.1        =        35
Y la bestia será hecha legión/1.2a =         9
ZenonWT/1.0.0        =         1
[http:/1.2a          =        14

gecko by vendor/version
AOL/7.0              =       620
AOL/8.0              =        35
Bayanihan/1.0        =        83
Beonex/0.8.1         =        88
CS 2000 7.0/7.0      =      1230
CS-Netscape6/6.1     =        10
CSIV-Netscape6/6.1   =        19
Chimera/0.5+         =      3510
Chimera/0.6          =     38282
Chimera/0.6+         =      8679
CyberSouls/20020906  =       204
Debian/0.9.9-6       =       165
Debian/1.0.0-0.woody.1 =     17492
Debian/1.0.0-1       =       343
Debian/1.0.0-2       =        11
Debian/1.0.0-3       =      5682
Debian/1.0.0-3.Xft.0 =         1
Debian/1.0.0.xandros1-3 =       104
Debian/1.0.1-0.3     =        10
Debian/1.0.1-2       =       441
Debian/1.0.1.xandros1-1 =       121
Debian/1.0rc2-2      =        10
Debian/1.0rc2-3      =        10
Debian/1.1-0.Xft.0   =        11
Debian/1.1-0.bunk    =        14
Debian/1.1-0pre1v1   =        83
Debian/1.1-1         =     11888
Debian/1.1a          =        21
Debian/1.2-0beta1    =        11
Debian/1.2-1         =       993
Debian/1.2.1-0       =         9
Debian/1.2.1-1       =       925
Debian/1.2.1-2       =       661
Debian/1.2.1-3       =       611
Debian/1.rc1-1       =        85
E-kochanPower/2800+  =        13
Explorer/6           =        10
GLU/0.0.16           =         8
GLU/1.0.2            =         8
GLU/1.0.4            =       123
GLU/1.0.8            =         8
GalionPublicLibrary/1.1 =         7
GalionPublicLibrary/1.1a =        27
IBM Web Browser for OS/2 =        30
K-Meleon/0.7         =        45
Kent Pharmaceuticals Ltd/6.2.3 =        11
Kristof/1.0          =        16
Mozilla-Gumi/Wazilla-Mac-1.1-trial7 =         9
Mozilla-Gumi/Wazilla-Mac-1.1-trial9 =        40
Mozilla/0.1          =        51
Mozilla/0.9          =       122
Mozilla/0.9.1        =       293
Mozilla/0.9.1+       =        13
Mozilla/0.9.2        =      2416
Mozilla/0.9.2+       =        10
Mozilla/0.9.2.1      =      3392
Mozilla/0.9.3        =       405
Mozilla/0.9.4        =      7532
Mozilla/0.9.4.1      =      4407
Mozilla/0.9.4.2      =       152
Mozilla/0.9.5        =      1559
Mozilla/0.9.5+       =         2
Mozilla/0.9.6        =       673
Mozilla/0.9.6+       =       213
Mozilla/0.9.7        =       838
Mozilla/0.9.7+       =       190
Mozilla/0.9.8        =      7517
Mozilla/0.9.8+       =       757
Mozilla/0.9.9        =     13765
Mozilla/0.9.9+       =       331
Mozilla/1.0          =       124
Mozilla/1.0.0        =    193546
Mozilla/1.0.0+       =      1354
Mozilla/1.0.1        =    148622
Mozilla/1.0.2        =      1404
Mozilla/1.0rc1       =      4896
Mozilla/1.0rc2       =      5594
Mozilla/1.0rc3       =      7618
Mozilla/1.1          =    416077
Mozilla/1.1+         =        10
Mozilla/1.1.0        =        10
Mozilla/1.1:         =        40
Mozilla/1.1a         =     12603
Mozilla/1.1a+        =      1234
Mozilla/1.1b         =     79391
Mozilla/1.2          =     38416
Mozilla/1.2.0        =         6
Mozilla/1.2.1        =     86150
Mozilla/1.2.x        =         2
Mozilla/1.2a         =     77475
Mozilla/1.2a+        =        42
Mozilla/1.2b         =    147100
Mozilla/1.2b+        =        36
Mozilla/1.2b-s       =         1
Mozilla/1.3a         =     30681
Mozilla/1.97         =        47
Mozilla/2.5.7        =        76
Mozilla/21.0.3       =         8
Mozilla/9.9.9        =         8
Mozilla/alpha        =        98
MultiZilla/v1.1.15   =       350
MultiZilla/v1.1.16   =        12
MultiZilla/v1.1.17   =       179
MultiZilla/v1.1.18   =      2826
MultiZilla/v1.1.20   =      2904
MultiZilla/v1.1.21   =      1779
MultiZilla/v1.1.22   =      9261
MultiZilla/v1.1.26   =        22
Netscape 6/6.2.1+    =        23
Netscape/4.07        =         2
Netscape/6.2         =        24
Netscape/7.0         =   1216006
Netscape/7.0+        =      6479
Netscape/7.01        =     51648
Netscape/7.0;        =        16
Netscape/7.0b1       =     60163
Netscape/7.0b1+      =      1892
Netscape/7.1         =        11
Netscape/7.6         =        71
Netscape6/6.1        =     23793
Netscape6/6.1/FJUSF01 =        29
Netscape6/6.1b1      =       328
Netscape6/6.2        =     42958
Netscape6/6.2.1      =     71232
Netscape6/6.2.2      =     42398
Netscape6/6.2.3      =    140368
Netscape6/6.2gnu.org =        43
Netscape6/6.5        =       303
Netscape6/7          =       238
Netscape6/7.0        =        31
Netscape7/7.0        =        15
Pescadero/0.1a       =        53
Phoenix/0.1          =      1935
Phoenix/0.2          =     23811
Phoenix/0.3          =     59772
Phoenix/0.4          =    123028
Phoenix/0.5          =     43519
PiTech/0.9           =         6
Smart WebGuide/1.0   =        10
Sylera/1.1.0         =        17
TCODEUTIWB20__000 IBM Web Browser for OS/2/DB =         1
TCODEUTIWB20__001 IBM Web Browser for OS/2/DB =        52
WebWasher/1.2.2      =        12
WebWasher/2.1.1rce   =        21
WebWasher/2.1.1rcw   =         1
WebWasher/2.1.1rcÓ   =         1
Y la bestia será hecha legión/31.337. =         9
ZenonWT/1.0          =         1
[http://www.soraia.com] =        14
</pre>

  <h3>Caveats for Server-Side Tracking</h3>

  <p>
    Except for Netscape, CompuServe and AOL-branded Gecko-based browsers,
    the variety of reported Vendors and Versions is practically unlimited.
  </p>
  <p>
    Netscape Gecko based browsers can <em>spoof</em> the user-agent string
    reported to the server. Therefore reliance on server reported user-agent strings to determine
    browser statistics will not be 100% accurate.
  </p>
  <p>
    Netscape Gecko based browsers can block images and cookies from 
    specific domains. If your reporting software uses images or cookies
    on external sites which have been blocked then you will not see
    a full report of Netscape Gecko based browsers visiting your site.
  </p>

  <h2 id="client">Tracking Netscape Gecko Client Side</h2>

  <p>
    Tracking Netscape Gecko traffic using client-side JavaScript requires use of the
    <a href="/library/xref/2002/client-data/property-data-navigator.html">navigator</a>
    object and depends upon whether JavaScript is enabled in the client.
  </p>

    <h3>Useful <code>navigator</code> properties for tracking Gecko</h3>

  <dl>
    <dt>navigator.userAgent</dt>
    <dd>
      <p>
        reports the user-agent string exactly as is reported to the server by the 
        user agent. Note that this property can be <em>spoofed</em> in the same
        fashion and is not 100% reliable in detecting Netscape Gecko based user
        agents.
      </p>
      <p>
        <code>navigator.userAgent</code> is the only place where you can find 
        the Gecko <code>rv</code> value.
      </p>
    </dd>

    <dt>navigator.product</dt>
    <dd>
      <p>
        will always be the string <code>Gecko</code> for Netscape Gecko browsers
        and is the most reliable means of detecting Gecko using JavaScript.
        This value can not be spoofed.
      </p>
    </dd>
    <dt>navigator.vendor</dt>
    <dd>
      <p>
        will be the vendor (blank for Mozilla). This value can not be spoofed.
      </p>
    </dd>
    <dt>navigator.vendorSub</dt>
    <dd>
      <p>
        will be the vendor's version. This value can not be spoofed.
      </p>
    </dd>
  </dl>

  <h3>Example</h3>

  <p>
    The following script uses URL encoded data to report
    on the version of Gecko or Microsoft Internet Explorer<sup>TM</sup>
    used.
  </p>

  <p>
    <img id="tracker" src="/lib/images/ns7-120x90.gif" />
  </p>

  <pre><![CDATA[
    var img = document.getElementById('tracker');
    var trk = '';

    if (navigator.product == 'Gecko')
    {
      var rv = navigator.userAgent.match(/rv:([\w.]+)/)[0];
      rv = rv.substr(3);
      var vendor = navigator.vendor;
      var version = navigator.vendorSub;
      if (!vendor)
      {
        vendor = 'Mozilla';
        version = rv;
      }
      trk = 'browser=Gecko/' + rv + ';vendor=' + vendor + '/' + version;
    }
    else 
    {
      var msiePos = navigator.userAgent.indexOf('MSIE ');
      if (msiePos != -1)
      {
        trk = 'browser=MSIE/' + parseFloat(navigator.userAgent.substr(msiePos + 5));
      }
    }

    img.setAttribute('src', img.getAttribute('src') + '?' + trk);
    ]]></pre>
  <script type="text/javascript">
    <![CDATA[
    var img = document.getElementById('tracker');
    var trk = '';

    if (navigator.product == 'Gecko')
    {
      var rv = navigator.userAgent.match(/rv:([\w.]+)/)[0];
      rv = rv.substr(3);
      var vendor = navigator.vendor;
      var version = navigator.vendorSub;
      if (!vendor)
      {
        vendor = 'Mozilla';
        version = rv;
      }
      trk = 'browser=Gecko/' + rv + ';vendor=' + vendor + '/' + version;
    }
    else 
    {
      var msiePos = navigator.userAgent.indexOf('MSIE ');
      if (msiePos != -1)
      {
        trk = 'browser=MSIE/' + parseFloat(navigator.userAgent.substr(msiePos + 5));
      }
    }

    img.setAttribute('src', img.getAttribute('src') + '?' + trk);
    ]]>
  </script>

  <h3>Caveats for Client Side Tracking</h3>

  <p>
    The value of the Gecko branch <code>rv</code> value can be modified if the
    user has spoofed their user-agent string.
  </p>

  <p>
    The effectiveness of client-side reporting is dependent on whether the user has enabled JavaScript.
  </p>

  <p>
    The effectiveness of of images or cookies in client-side reporting is depenendent on 
    whether the user has blocked images or cookies for the domain.
  </p>

  <h2 id="conclusion">Conclusion</h2>

  <p>
    Tracking accurate user agent statistics for Netscape Gecko-based browsers can be a very complicated affair. 
    Rather than relying solely on your web analytics software reports, be sure to 
    check the results against known results found in your web server logs.
  </p>

  <h2 id="references">References</h2>
  <ul>
    <li>
      <a href="/viewsource/2002/browser-detection/">Browser Detection and Cross Browser Support</a>
    </li>
    <li>
      <a href="http://www.mozilla.org/build/revised-user-agent-strings.html">Mozilla user-agent Strings</a>
    </li>
    <li>
      <a href="/viewsource/2002/gecko-useragent-strings/">Netscape Gecko User Agent Strings</a>
    </li>
    <li>
      <a href="http://support.microsoft.com/default.aspx?scid=KB;en-us;167820">Microsoft Knowledge Base Article 167820 - HOWTO: Determine Browser Version</a>
    </li>
  </ul>
  </nde:content>
  <nde:related area="nde">
    <nde:item url="/viewsource/2002/browser-detection/">Browser Detection and Cross Browser Support</nde:item>
    <nde:item url="/viewsource/2002/gecko-useragent-strings/">Netscape Gecko User Agent Strings</nde:item>
  </nde:related>
  <nde:related area="ext">
    <nde:item url="http://www.mozilla.org/build/revised-user-agent-strings.html">Mozilla user-agent Strings</nde:item>
    <nde:item url="http://support.microsoft.com/default.aspx?scid=KB;en-us;167820">Microsoft Knowledge Base Article 167820 - HOWTO: Determine Browser Version</nde:item>
  </nde:related>
</nde:article>

