When the Smoc bot engine makes a decision about what edge to follow next, it uses Smoc Expressions to assign a score to each possible edge. This article explains the syntax in detail.
It then follows an edge as follows:
- If no edges have a positive score, no edge is followed.
- IMPORTANT: Always add a default edge with a score of
0.5
to ensure the bot does not get stuck.
- IMPORTANT: Always add a default edge with a score of
- If one edge has a higher score than all other edges, it will be followed.
- If multiple edges have the highest score, a random one amongst them is followed.
Smoc Expressions are infix arithmetic expressions.
Valid operators are +
, -
, *
and /
. You can also use (
and )
to group sub-expressions.
Each operand is either a number or a variable. Most variables expect a case insensitive argument following the =
sign.
For example:
2 * ${answer=34}
In this example, the first operand is 2
(a number), and the second operand is ${answer=34}
(a variable).
A variable evaluates to either 0
or 1
. The ${answer=34}
variable will evaluate to 1
only if the visitor has given a survey question answer with the id 34
.
There are many Smoc Expression variables to choose from, and most of them represent facts we know about the visitor before they have started interacting with the bot (such as geolocation, decive type, utm_
variables etc).
The table below lists all the available Smoc Expression variables.
Name | Example | Description |
---|---|---|
answer |
${answer=95431} |
Checks if this answer ID is among previously given survey quesion answers. |
browser |
${browser=2345Explorer} |
One of the following: 2345Explorer / 360 Browser / Alipay / Amaya / Android Browser / Arora / Avant / Avast Secure Browser / AVG Secure Browser / Baidu Browser / Basilisk / Blazer / Bolt / Bowser / Brave / Camino / Chimera / Chrome / Chrome Headless / Chrome WebView / Chromium / Cobalt / Coc Coc / Comodo Dragon / Conkeror / Dillo / Dolphin / Doris / DuckDuckGo / Edge / Epiphany / Facebook / Falkon / Fennec / Firebird / Firefox / Firefox Focus / Firefox Reality / Flock / Flow / GoBrowser / GSA / HeyTap / Huawei Browser / iCab / ICE Browser / IceApe / IceCat / IceDragon / IceWeasel / IE / Instagram / Iridium / Iron / Jasmine / K-Meleon / KakaoTalk / KHTML / Kindle / Klar / Klarna / Konqueror / LBBROWSER / Line / LinkedIn / Links / Lunascape / Lynx / Maemo Browser / Maxthon / Midori / Minimo / MIUI Browser / Mobile Chrome / Mobile Firefox / Mobile Safari / Mosaic / Mozilla / Naver / NetFront / Netscape / Netsurf / Nokia Browser / Obigo / Oculus Browser / OmniWeb / Opera / Opera Coast / Opera Mini / Opera Mobi / Opera Tablet / Opera Touch / OviBrowser / PaleMoon / PhantomJS / Phoenix / Pico Browser / Polaris / Puffin / QQBrowser / QQBrowserLite / Quark / QupZilla / rekonq / Rockmelt / Safari / Sailfish Browser / Samsung Internet / SeaMonkey / Silk / Skyfire / Sleipnir / SlimBrowser / Smart Lenovo Browser / Snapchat / Sogou Explorer / Sogou Mobile / Swiftfox / Tesla / TikTok / Tizen Browser / Twitter / UCBrowser / UP.Browser / Vivaldi / Vivo Browser / w3m / Waterfox / WebKit / WeChat / Weibo / Whale / Wolvic / Yandex |
city |
${city=some_city} |
A string |
country_code |
${lang=NO} |
A 2-letter ISO 3166 country code |
country_name |
${country_name=some_country_name} |
A string |
device_type |
${device_type=console} |
One of the following: console / desktop / embedded / mobile / smarttv / tablet / wearable / xr |
landing_page |
${landing_page=some_landing_page} |
A string |
lang |
${lang=da-DK} |
One of the following: da-DK / en-GB / es-ES / fi-FI / nb-NO / sv-SE |
os |
${os=AIX} |
One of the following: AIX / Amiga OS / Android / Android-x86 / Arch / Bada / BeOS / BlackBerry / CentOS / Chrome OS / Chromecast / Contiki / Debian / Deepin / DragonFly / elementary OS / Fedora / Firefox OS / FreeBSD / Fuchsia / Gentoo / GhostBSD / GNU / Haiku / HarmonyOS / HP-UX / Hurd / iOS / Joli / KaiOS / Linpus / Linspire / Linux / macOS / Maemo / Mageia / Mandriva / Manjaro / MeeGo / Minix / Mint / Morph OS / NetBSD / NetRange / NetTV / Nintendo / OpenBSD / OpenVMS / OS/2 / Palm / PC-BSD / PCLinuxOS / Plan9 / PlayStation / QNX / Raspbian / RedHat / RIM Tablet OS / RISC OS / Sabayon / Sailfish / SerenityOS / Series40 / Slackware / Solaris / SUSE / Symbian / Tizen / Ubuntu / Unix / VectorLinux / Viera / watchOS / WebOS / Windows / Windows Mobile / Windows Phone / Xbox / Zenwalk |
os_version |
${os_version=some_os_version} |
A string |
referral |
${referral} |
The referral variable evaluates to 1 if the visitor has a referral ID. Do not supply an argument to this variable. To obtain a value of 0 if the visitor has a referral ID, use a 1 - ${referral} expression. |
referrer |
${referrer=some_referrer} |
A string |
referring_domain |
${referring_domain=some_referring_domain} |
A string |
region |
${region=some_region} |
A string |
time |
${time=* 13-16 * * 1-5} |
Checks whether the visitor's local time is within a specific time schedule. The argument must be a cron expression. For example, ${time=* 13-16 * * 1-5} evaluates to 1 if the visitors local time is between 13:00 and 16:59 on a weekday, otherwise it evaluates to 0` |
user_agent |
${user_agent=some_user_agent} |
A string |
utm_campaign |
${utm_campaign=some_utm_campaign} |
A string |
utm_content |
${utm_content=some_utm_content} |
A string |
utm_medium |
${utm_medium=some_utm_medium} |
A string |
utm_source |
${utm_source=some_utm_source} |
A string |
utm_term |
${utm_term=some_utm_term} |
A string |
within |
${within=51.5508887,-0.0946755 (radius: 10000 meters)} |
Checks whether the visitor is within a certain radius of a geo location. |