Catalyst::Plugin::ReferingKeyword - Catch the keyword from a search that brought a visitor to your CatApp.
use Catalyst qw( Unicode ReferingKeyword ); # ...then later, in a template perhaps You seek <i>[% c.refering_keyword || "nothing in particular" %]</i>.
The aim is pretty simple though the task can be quite convoluted. Take, when available, the refering (sic, we use refering b/c someone somewhere decided to use referer, sigh) query string, when it exists, and try to parse out the real search term the user had entered on the refering site.
This is a sort of a toy plugin right now. Feedback might help turn it into something more robust and fully documented.
Does the regular configuration stuff. Not documented yet.
Where we hook into the request->referer, when it's there.
Only public method. Returns the most important, as far as the software can tell, value from the refering URI query parameters. E.g., a Google search might look like:
The refering_keyword that will be caught and returned is "catalyst plugins." As there is no standard for query parameters key names, there is no perfect way to capture them. It's possible to capture them by things like key name lists per domain but that is a never ending dictionary approach. In this module we use a weighting system to try to see which value in the key=value pairs seems the most like a search term and the least like application dialect.
Failures will typically be empty when there was one that could have been caught or the wrong part of a query, such as "true." Improvements to the algorithm are welcome.
Next version. :)
No bugs have been reported.
Please report any bugs or feature requests to
firstname.lastname@example.org, or through the web interface at http://rt.cpan.org.
Open algorithm to tweaking or other backends. Expand POD. Write more tests than the stock stuff.
Ashley Pond V
Copyright (c) 2007, Ashley Pond V. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with you. Should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.
In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above licence, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.