The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

  use WWW::Compete;

  use constant COMPETE_API_KEY => 'XXXXX'; 

  my $c = WWW::Compete->new({api_key => COMPETE_API_KEY}); 
  $c->fetch("cpan.org");

  $c->get_measurement_yr(); 
  $c->get_measurement_mon();
  $c->get_trust();         
  $c->get_visitors();     
  $c->get_rank();        
  $c->get_summary_link();       

DESCRIPTION

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

METHODS

WWW::Compete->new(\%args)

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();
$c->api_key( COMPETE_API_KEY );

Get/set the Compete API key to be used.

$c->api_ver();
$c->api_ver( $api_version );

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

$c->ua();
$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.

$c->get_measurement_yr()

Returns the year for the measurement.

$c->get_measurement_mon()

Returns the month for the measurement.

$c->get_domain()

Returns the current domain.

$c->get_visitors()

Returns the unique visitor estimate for measurement year and month.

$c->get_rank()

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

$c->get_trust()

Returns trust rating for the domain.

$c->get_summary_link()

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

SEE ALSO

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.

http://developer.compete.com/

AUTHOR

Chris Mills, <cmills@cpan.org>

COPYRIGHT AND LICENSE

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.