 
         
        Automating Reamaze Cues
Introduction
Reamaze Cues can be set to automatically display when certain Rules have been matched, for example if the user is about to leave the site, or if the user has been on this page for more than a minute, or if the user is on a specific page.
A Rule is defined as an object with the parameters type, op and value. Here is an example of a Rule and its usage in a Cue:
// this is a Cue object
{
  id: "cue-rules-test",
  message: "This Cue is displayed once the user has been on the page for longer than 1 minute and if the URL matches '/pricing'.",
  rules: [
    {
      type: "timeOnPage",
      op: "greaterThan",
      value: "1m"
    },
    {
      type: 'url',
      op: 'contains',
      value: '/pricing'
    }
  ]
}
Here is a list of Rule types as well as the supported operators:
| Type | Supported Operators | Description | 
|---|---|---|
| url | equalsnotEqualscontainsdoesNotContain | Matches valueagainst the current page URL. | 
| referrer | equalsnotEqualscontainsdoesNotContain | Matches valueagainst the referring URL, determined fromdocument.referrer. | 
| timeOnPage | greaterThanlessThan | Time the user spent on the current page. The valueby default is in seconds, but can be written in minutes or hours, for example2mfor 2 minutes, or2hfor 2 hours. | 
| timeOnSite | greaterThanlessThan | Time the user spent on your site. The valueby default is in seconds, but can be written in minutes or hours, for example2mfor 2 minutes, or2hfor 2 hours. | 
| date | greaterThanlessThan | Matches valueagainst the current date.valueis a datetime string in ISO format, for example:2017-05-16T22:26:03.272Z | 
| leavingSite | isTrueisFalse | Detects if the site visitor is about to leave the page or the site. valueis ignored on this Rule. | 
| identified | isTrueisFalse | A user is identifed if the user is identified by Reamaze, either via SSO, or if the user has started a conversation before. valueis ignored on this Rule. | 
| nthVisit | greaterThanlessThan | Number of visits to your site. valueis an integer value denoting the number of times the user has been to your site. | 
| inOfficeHour | isTrueisFalse | Whether it's during or outside office hours. If office hours are not set, this will always resolve to True. | 
| staffAvailable | isTrueisFalse | Whether there are staff available for chat. This only applies to Classic Live Chat. | 
| deviceType | equals | A user is identifed if the user is identified to be using the device in value. Allowedvalueoptions aredesktopandmobile | 
| customerLocation | equalsnotEquals | Matches the country code valueagainst the user's location. For the U.S. and Canada, you can also target the state/province by adding a colon and the state/province code (e.g.US:NY). | 
Next Step
If you'd like full control of when and how to display a Cue, check out our Advanced Usage section. You'll also be able to customize the default click behavior of a Cue as well as whether the sound plays when a Cue is displayed.
      Join thousands of teams using Reamaze to impress customers.
      
      Find out how with a free account.
    
