Created
June 11, 2010 05:22
-
-
Save MikeGrace/434089 to your computer and use it in GitHub Desktop.
Kynetx app that pulls search term from URL on pageview for Devex question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset a60x267 { | |
meta { | |
name "Fire rule on search" | |
description << | |
Fire rule on search | |
>> | |
author "Mike Grace" | |
logging on | |
} | |
dispatch { | |
domain "yahoo.com" | |
domain "google.com" | |
domain "bing.com" | |
} | |
global { } | |
rule if_search_term_found is active { | |
select when pageview "yahoo\.com.*[?&]p=([^&]*)" setting (searchTerm) | |
or pageview "google\.com.*[?&]q=([^&]*)" setting (searchTerm) | |
or pageview "bing\.com.*[?&]q=([^&]*)" setting (searchTerm) | |
pre { | |
query = page:url("query"); | |
msg = << | |
Query string: #{query}<br/> | |
Search term: #{searchTerm} | |
>>; | |
} | |
if( searchTerm neq "" ) then { | |
notify("Search Data", msg) with sticky = true; | |
} | |
} | |
rule if_search_term_not_found is active { | |
select when pageview "yahoo\.com.*[?&]p=([^&]*)" setting (searchTerm) | |
or pageview "google\.com.*[?&]q=([^&]*)" setting (searchTerm) | |
or pageview "bing\.com.*[?&]q=([^&]*)" setting (searchTerm) | |
pre { | |
query = page:url("query"); | |
msg = << | |
Query string: #{query}<br/> | |
Was a search done? | |
>>; | |
} | |
if( searchTerm eq "" ) then { | |
notify("Search Data", msg) with sticky = true; | |
} | |
} | |
} |
Updated with rules that only fire actions if search term is found or not found.
Related Devex question at http://devex.kynetx.com/questions/468/only-fire-rule-if-search-has-been-done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to properly pull search terms from url on pageview