Chris Mills


WWW::Compete - Simple OO interface for retrieving site rank, traffic stats, and trust rating from


  use WWW::Compete;

  use constant COMPETE_API_KEY => 'XXXXX'; 

  my $c = WWW::Compete->new({api_key => COMPETE_API_KEY}); 



This module is a simple wrapper around the Site Analytics API offered by You can use this to basic traffic-related statistics for your favorite, or even your least favorite, domain.



Valid arguments:

  • api_key

    string. Compete API key

  • api_ver

    string Version of the Compete API you wish to use. Defaults to 3.

  • return_int

    boolean If value evaluates to true, formatting will be removed from visitor counts an rank. For example, you'll get '4321567' instead of '4,321,567.' Defaults to false.

$c->api_key( COMPETE_API_KEY );

Get/set the Compete API key to be used.

$c->api_ver( $api_version );

Get/set the Compete API version you want to interact with. Default is 3.

$c->ua( $user_agent );

Get/set the User-Agent header sent with your API requests. By default this is "libwwww-perl/#.##". Depending on what you're doing you may want to pass something else.

$c->fetch( $domain );

Send a request to the Compete API asking for stats on $domain.


Returns the year for the measurement.


Returns the month for the measurement.


Returns the current domain.


Returns the unique visitor estimate for measurement year and month.


Returns ranking for the domain, based on unique visitor estimates.


Returns trust rating for the domain.


Returns a link to Compete's traffic summary page for the domain.


This module is a wrapper around the Compete Site Analytics API. Additional detail on the API, and also on how to get a developer key, is available here.


Chris Mills, <>


Copyright (C) 2009 by Chris Mills

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.