What are expert segments, how can i define them and some helpful examples.
Segments allow you to specify a subset of report data that satisfies the Filters you define. When you generate a report for an Experiment, you can apply multiple Segments so that the report uses only data that matches all of the selected Segments. This can be helpful in demonstrating if different user groups or behaviors react differently. Segments offers a limited input field when defining these groups.
By contrast Expert Segments allow for the creation of more complex identification of groups of users and behaviors within experiments then standard segments. To allow for this Expert Segments offers an open field input for expressions. These can be thought of in a similar way to that of equations in Microsoft Excel.
Notes on Segments (Expert Mode):
- The Segment Expression allows you to combine fields using standard SQL Operators. Each is explained within the list of available operators tool tip.
- To add fields to the Segment Expression, select a field from the Variable drop-down.
- You can include literal numbers and text strings, but you must surround all strings with single quotes.
- You can use parenthesis to group fields and expressions and to change the order of operations.
- Once you have defined a Segment, it appears on the Segments drop-down on each of the Reports pages.
Examples of Expert Segments:
How to locate a single SiteSpect User ID aka SSGUID:
[GUID] REGEXP ("7327215384023603335")
([StartTime] >= 1575950400 && [StartTime] <= 1575979200)
Notes on Segments (Expert Mode):
Expert Segment Filters:
Metrics: A list of active Metrics and their Data Points. Only those Campaigns that include the selected Metrics may use this Segment.Use the following set of mathematical and logical operators in your equation:
- Mathematical:
+
Addition-
Subtraction*
Multiplication/
Division()
Grouping - Follows standard mathematical order of operation rules.=
Equal To<=>
NULL
-safe equal to. Performs an equality comparison like the=
operator but returns 1 rather thanNULL
if both operands areNULL
and 0 rather thanNULL
if one operand isNULL
.<>
,!=
Not Equal To<
Less Than>
Greater Than<=
Less Than or Equal To>=
Greater Than or Equal ToROUND(n)
,ROUND(n, d)
Rounds the argument n to d decimal places. d defaults to 0 if it is not specified. - Logical:
AND
,&&
LogicalAND
. Returns 1 if all operands are nonzero and notNULL
. Returns 0 if one or more operands is 0. Otherwise, it returnsNULL
.OR
,||
LogicalOR
. When both operands are non-NULL
, returns 1 if any operand is nonzero and 0 otherwise. If an operand isNULL
, it returns 1 if the other operand is nonzero andNULL
otherwise. If both operands areNULL
, it returnsNULL
.NOT
,!
LogicalNOT
. Returns 1 if the operand is 0; 0 if the operand is nonzero;NULL
if the operand isNULL
. - Misc.:
NULL
A
NULL
value represents an unknown variable in a Campaign. Any operation involving aNULL
value results inNULL
; aNULL
value is not true in a test operation (e.g.,NULL = NULL
returnsNULL
, which evaluates to false).The Data Points for past visits to a Campaign when a Metric is added are
NULL
.The Value Capture Data Point for a Metric that did not match is
NULL
.When the location of a visit cannot be determined, the Geographic Location variables are
NULL
.Mobile device variables for non-mobile or unknown device users are
NULL
.UNIX_TIMESTAMP()
,UNIX_TIMESTAMP(date)
If called with no argument, returns the current Unix timestamp (seconds since 1970-01-01 00:00:00 UTC). If called with a date argument, it returns the value of the argument as seconds since 1970-01-01 00:00:00 UTC. date is a string in the format
'YYYY-MM-DD HH:MM:SS'
, or a number in the format YYYYMMDDHHMMSS. The date is interpreted as a value in UTC.This function is used with the Start Time variable to perform date calculations. For example, to test if a visit started within a time frame, use an equation such as:
[Start Time] BETWEEN UNIX_TIMESTAMP(20120701040000) AND UNIX_TIMESTAMP(20120705035959)
. Remember to convert the dates to UTC.COUNT_STRING(match, source)
,Finds the number of occurrences of match in the source string. Usage: (COUNT_STRING('"PageMatch"',[RP:1:CustomVariables]))
- Tests:
IF(expr, then, else)
If expr is nonzero andNOT NULL
then this returns then, otherwise it returns else.IFNULL(expr, else)
If expr is notNULL
then this returns expr, otherwise it returns else.expr LIKE pattern
Performs pattern matching using SQL simple Regular Expression comparison.%
Matches any number of characters, even zero characters._
Matches exactly one character.\%
Matches one "%" character.\_
Matches one "_" character.expr REGEXP pattern
Performs pattern matching using SQL Regular Expression comparison. SQL RegEx supports only a limited subset of SiteSpect's RegEx capibilities. Non-greedy quantifiers (.*?
) and escape characters (\d
) are not supported.
Each REGEXP expression has a limit of 30,000 characters. The entire segment expression cannot exceed 1,000,000 characters.expr BETWEEN min AND max
If expr is greater than or equal to min and expr is less than or equal to max,BETWEEN
this returns 1, otherwise it returns 0.expr IS NULL
,expr IS NOT NULL
Tests whether a value is (NOT
)NULL
(e.g.,NULL IS NULL
returns true).