React differently if second time user visits domain
I am working on building a Kynetx app that fires a different action on a domain if it is the second time a user has visited the page. I think I need to use a persistant trail to mark when a user visits a page but I'm not sure how to check the trail to see if a value is already there and matches the current domai开发者_如何学编程n.
Current code:
rule put_data_onto_trail {
select when pageview ".*"
pre {
domain = page:url("domain");
}
{
notify("Thanks for visiting #{domain}","You visit has been recorded") with sticky = true;
}
fired {
mark ent:visitedDomains with domain;
}
}
KRL provides the seen
operator just for this purpose. It takes a regular expression as a string. So your if
check could look something like this:
if seen ".*awesome.*" in ent:mytrail then {
// take over the world
}
精彩评论