Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds the set_source SpecialSub which is called when the affiliate source is about to be set or changed. The sub is called with three args: source - This is the new affiliate source that is about to be set. priority - This is the priority (as per the SourcePriority configuration directive) that this source change falls under. oldsource - This is the affiliate source that was already set and is about to be overwritten. Return values: Any defined value returned by this sub becomes the new affiliate source. If undef is returned then the old source is kept and processing continues onto the next priority in the SourcePriority list. Example usage: The following example usage will make sure that a customer who enters your site with an affiliate source does not do so from a search engine link: Sub <<EOS sub source_check_referer { my ($source, $priority) = @_; return $source unless $priority eq 'mv_pc' || $priority eq 'mv_source'; my $referer = $Tag->env('HTTP_REFERER'); my @bad_referers = qw{ www.google www.bing.com search.yahoo.com www.dnsrsearch.com thesmartsearch.net yandex.ru duckduckgo.com www.searchassist.net baidu.com }; for (@bad_referers) { return if $referer =~ /\Q$_\E/; } return $source; } EOS SpecialSub set_source source_check_referer
- Loading branch information