Custom Tags

Tags are engaging personalization features that can be applied to all Message types. As you add Player Properties these become Audience Filter Options, as well as Tag options in your Messages.

In addition to your Player Properties, you can find a few tags built into Teak by selecting the @ icon when creating Messages.

Facebook Tags

If your game has integrated the Facebook SDK, and provides Teak with Facebook App Scoped User IDs through IdentifyUser then you can use these builtin Facebook tags to personalize message content with the player’s real name.

{{first_name}}

Insert the player’s first name

{{last_name}}

Insert the player’s last name

{{full_name}}

Inser the player’s full name

Teak will replace these tags with an empty string for any players who have not connected with Facebook. We highly recommend using these tags with the default filter to provide a fallback name for players who are not Facebook connected.

Email Tags

Teak provides a set of email specific tags for use in email message content.

{{email.link}}

Insert Teak’s generated tracking/reward URL for the email. Note that in Teak’s provided email template, the image already links to the generated tracking/reward URL for the email.

{{email.unsubscribe}}

Insert the URL to the player’s subscription management page for email. Note that in Teak’s provided email template, the unsubscirbe link is already included in the email footer.

{{email.footer}}

Insert the default email footer into the email. Note that the footer is already included in Teak’s provided email template.

{{email.send_id}}

Insert Teak’s unique id for the specific email send. This may be useful to correlate clicks on other links with events reported to your internal analytics tooling through Teak’s Data Syncing.

{{email.to_address}}

Insert the email address the email is being sent to.

If you are inserting any tags into a link in an email, be sure to use the url_encode filter to properly escape the text so the link will function correctly.

Local Notification Tags

When a Message is associated with a Local Schedule you can use custom tags from data passed in by the game as personalizationData when it makes the Teak SDK call to send the notification (See Teak.Notification.Schedule(string,long,Dictionary<string, object>,Reply)). All of the data passed in as personalizationData will be available under local. Ask your dev team what data they are passing in as personalizationData. In particular, you will need to know the name of the "keys" that the dev team is using, since you will need to know the name of the "key" to template data into the message. For example, if the call provides data in a key named level, you can template the data into the Message with the tag {{local['level']}}.

We highly recommend using a default filter on all tags using local to provide a fallback in case the personalizationData in the Teak SDK call does not include the appropriate key. Ask your dev team if this can happen, and consider what would be appropriate to show to the player if the relevant data is not provided.

Other customizable Tags

Fallback if Player Name is unavailable

{{first_name|default: "Hey_Pal"}} Replace Hey Pal with a generic phrase or salutation.

Simplify a large complex number

{{some_number | number_to_human}} If there is a player property called some_number, the number_to_human filter will simplify that value to something you would say in conversation.

Example 1. Coins

If a player has a total of 300,144 Coins, your message could say "Let’s make you a millionaire! Collect 700,000 Coins to add to your balance of 3 Hundred Thousand."

If you’d rather have more numeric places, you can add a qualifier. For instance {{coins| number_to_human: 3}} would display their balance as 300 Thousand.

If you prefer the complex number: {{some_number}} will do the trick in the above example it would output 300,144. And if you want to get rid of the comma, use {{some_number | unfancy}} to display 300144.

Standard Filters

Filters modify the result of an output statement. Teak supports the following Liquid Filters:

append

append a string e.g. {{ 'foo' | append:'bar' }} #=> 'foobar'

capitalize

capitalize words in the input sentence

ceil

rounds a number up to the nearest integer, e.g. {{ 4.6 | ceil }} #=> 5

date

reformat a date (syntax reference)

default

returns the given variable unless it is null or the empty string, when it will return the given value, e.g. {{ undefined_variable | default: "Default value" }} #=> "Default value"

divided_by

integer division e.g. {{ 10 | divided_by:3 }} #=> 3

downcase

convert an input string to lowercase

escape_once

returns an escaped version of html without affecting existing escaped entities

escape

html escape a string

floor

rounds a number down to the nearest integer, e.g. {{ 4.6 | floor }} #=> 4

lstrip

strips all whitespace from the beginning of a string

minus

subtraction e.g. {{ 4 | minus:2 }} #=> 2

modulo

remainder, e.g. {{ 3 | modulo:2 }} #=> 1

newline_to_br

replace each newline (\n) with html break

plus

addition e.g. {{ '1' | plus:'1' }} #=> 2, {{ 1 | plus:1 }} #=> 2

prepend

prepend a string e.g. {{ 'bar' | prepend:'foo' }} #=> 'foobar'

remove_first

remove the first occurrence e.g. {{ 'barbar' | remove_first:'bar' }} #=> 'bar'

remove

remove each occurrence e.g. {{ 'foobarfoobar' | remove:'foo' }} #=> 'barbar'

replace_first

replace the first occurrence e.g. {{ 'barbar' | replace_first:'bar','foo' }} #=> 'foobar'

replace

replace each occurrence e.g. {{ 'foofoo' | replace:'foo','bar' }} #=> 'barbar'

round

rounds input to the nearest integer or specified number of decimals e.g. {{ 4.5612 | round: 2 }} #=> 4.56

rstrip

strips all whitespace from the end of a string

size

return the size of an array or string

slice

slice a string. Takes an offset and length, e.g. {{ "hello" | slice: -3, 3 }} #=> llo

split

split a string on a matching pattern e.g. {{ "a~b" | split:"~" }} #=> ['a','b']

strip_html

strip html from string

strip_newlines

strip all newlines (\n) from string

strip

strips all whitespace from both ends of the string

times

multiplication e.g {{ 5 | times:4 }} #=> 20

truncate

truncate a string down to x characters. It also accepts a second parameter that will append to the string e.g. {{ 'foobarfoobar' | truncate: 5, '.' }} #=> 'foob.'

truncatewords

truncate a string down to x words

upcase

convert an input string to uppercase

url_encode

url encode a string