Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update for Node engine

Event attributes are one of the most important sources of data for computation in a rule because they convey information about the context of the event. In Chapter 3, you saw how eventexes can use expressions on event attributes as filters for which events match a given primitive eventex. Event attributes can also be used in KRL expressions. To avoid conflict with user-declared variables names, event attributes are namespaced using the keyword event. (Prepending the namespace name and a colon to a variable forms namespaces in KRL.)

...


Assume that a rule has been selected based on a pageview event with an event attribute url. The following KRL expression could be used to extract the domain name from the url attribute:
 

event:attr("url").extract(#httpre#http://(\[^/?]+)#)

 

...


Event attributes can be sent to an event in several different ways. If one is submitting an event using a One way is by using GET or POST request, the GET or POST arguments can be accessed using the following syntax:

 

event:attr("argument_name")

 

 

Event attributes can also be sent when raising an explicit requests with the HTTP library. The other way is to raise an event using the with keyword. The following KRL would raise an event with event attributes:

 

raise explicit event "testEventAttributes" for a1x100
   with foo = "bar";

...