2

In KRL (Kynetx Rule Language), how can I write a select statement that selects on all pages?

Alex
  • 64,178
  • 48
  • 151
  • 180

2 Answers2

2
select when pageview ".*"
Jessie A. Morris
  • 2,267
  • 21
  • 23
2

Because the select statements for web events in KRL are regular expressions you can use the following select statement to fire on all pages viewed:

select when web pageview ".*"

Example in context of full ruleset:

ruleset a60x425 {
  meta {
    name "test select on all pages"
    description <<
      this will select on all pageviews
    >>
    author "Mike Grace"
    logging on
  }

  dispatch { }

  rule selection_test_on_all_pages {
    select when web pageview ".*"
    {
      notify("I selected on this page!","woot!") with sticky = true;
    }
  }
}

Note 1: This doesn't address the issue of dispatch domains and browser extensions. This will work as expected when executed from a bookmarklet. Browser extensions won't make it to the selection expression unless the currently viewed domain matches a domain set in the dispatch block. This examples dispatch domain is blank because I am making the assumption that the app will be run from a bookmarklet.

Note 2: Selection expressions get compiled into a regular expression so it's important to remember that you don't need to use the 're//' format for the expression like you do everywhere else in language you use a regular expression.

Mike Grace
  • 16,636
  • 8
  • 59
  • 79