Expand description
Rust implementation of referer-parser, identifying the source of a HTTP referer URL (search engine, social network, webmail, etc.) and extracting the search term when available.
§Example
use referer_parser_rs::Parser;
use url::Url;
let parser = Parser::new("referers.yml").unwrap();
let url = Url::parse("https://www.google.com/search?q=hello+world").unwrap();
if let Some(entry) = parser.lookup(&url) {
assert_eq!(entry.medium, "search");
assert_eq!(entry.source, "Google");
assert_eq!(entry.search_term.as_deref(), Some("hello world"));
}Structs§
- Entry
- A matched referer entry.
- Parser
- Referer parser backed by the snowplow referers.yml database.