There are some restrictions on how you can enter key names and values when you add key-values.
Valid key names
- Are not case-sensitive
- Cannot start with a number
- Cannot contain spaces
Keys used in the pattern match macro and the video metadata macro only support alphanumeric characters and underscore (_).
A custom key within an audience segment only supports alphanumeric characters and underscore (_). Custom keys in audience segments must start with a non-numeric character. For example, abc123
is valid; 123abc
is not. Learn more about audience segments.
Valid value names
- Are not case-sensitive
- Can start with a number, contain only numbers, or be a combination of numbers and letters
- Can contain spaces
While value names can contain spaces, key names cannot. For example, this key-value pair is not valid because there are spaces in the key name:
sports car=aston-martin-db5
However, this key-value pair is valid since value names can contain spaces:
car="aston martin db5"
Spaces in value names must use double quotes
When value names contain spaces, they should be wrapped in double quotation marks when included in an ad tag or when using the advanced expression targeting feature.
Values are treated as strings even if they are numbers. That means that numbers can't be evaluated or calculated. For example, the following is not a valid expression and wouldn't produce results of users above the age of 18 and below the age of 32:
age >= 18 AND age <= 32
Instead, you need to capture the age range as text in a single key-value pair:
age=18-32
Disallowed characters in keys and values
The following characters are reserved and not allowed in key names or values. Some of these characters can be used for the advanced expression targeting feature.
Character | Description | Character | Description |
---|---|---|---|
" | Double quotes | ; | Semicolon |
' | Single quotes or apostrophe | ^ | Caret |
= | Equal sign | () | Parentheses |
! | Exclamation point | < > | Angle brackets |
+ | Plus sign | [ ] | Square brackets |
# | Pound or hash symbol | , | Comma |
* | Asterisk | & | Ampersand |
~ | Tilde |