Smart Tags


1. What are Smart Tags?


Smart Tags offer a deep level of personalization of browsing experience by changing parts of a message based on Visitor Properties. With Smart Tags, you can create 1:1 personalised messages that make your visitors feel like your offers are talking to the directly.

Imagine if you could thank every person that visited your ecommerce site by name… or provide a special offer based on the products they’ve viewed… all without lifting a finger. Well, that’s exactly what Smart tags can do. In this article, we show you how you can use them easily on your website.

Smart Tags let you alter the text in popups or Embedded Content based on any Visitor Property you wish. This way, you can display highly targeted messages to individual visitors in a single campaign.

You don’t have to create different campaigns for all the different groups in your audience. Smart Tags give you the power to display fully-personalized messages that engages your visitors and encourages them to buy or subscribe based on their specific needs. For example, you may want to address customers by their name or display the total value of their current cart content.


2. What type of Visitor Properties can be used for Smart Tags?

Smart Tags can be built upon various Visitor Properties from simple ones to complex ones. For example, you may want to display the name of the country your visitor is coming from - which is based on First-Party Data collected automatically by OptiMonk - or include their behavioral preference such as Coffee Lover that you know from a survey - which is based on Zero Party Data you have collected previously in OptiMonk or your own database (in which case we refer to it as a Custom Variable).

In short, variables for Smart Tags can be acquired from different sources, including

  • automatic collection by OptiMonk - called First-Party Visitor Properties,
  • collection through OptiMonk campaigns via input fields in campaigns- called Zero -Party Visitor Properties,
  • or from a custom source you implement as Custom Visitor Properties.

⚠️ These different Visitor Properties can be used to create Smart Tags or in targeting as well to create different segments.

Zero-Party Visitor Properties

Zero-Party Visitor Properties refer to data that your visitors provide to you directly. For instance, if you ask them about their first name or e-mail address in a sign-up form, those pieces of data are considered Zero-Party Visitor Properties. You can ask your visitors to provide any piece of information you might be interested in and want to use later as Smart Tags or as targeting rules.

To collect Zero-Party Visitor Properties, you can use OptiMonk's built in Form Elements in Editor:

  • Input Fields,
  • Radio Buttons,
  • Checkboxes,
  • Dropdowns,
  • Feedback Elements,
  • Textarea,
  • Survey Elements.

If you ask for first name in a text input field, you can later personalize your messages in Editor using the [[attribute:firstname]] Smart Tag.



Learn more about Input Fields here.

First-Party Visitor Properties

Static Visitor Properties (visitors receive upon their first visit)

  • [[attribute:first_landing_page]]
  • [[attribute:first_visit_date]]
  • [[attribute:utm_source]]
  • [[attribute:utm_medium]]
  • [[attribute:utm_campaign]]
  • [[attribute:utm_content]]

Dynamic Visitor Properties (change based on visitor behavior)

  • [[attribute:current_month_text_en]]
  • [[attribute:current_month_text_hu]]
  • [[attribute:browser_language]]
  • [[attribute:browser_name]]
  • [[attribute:browser_version]]
  • [[attribute:os_name]]
  • [[attribute:os_version]]
  • [[attribute:tz_offset]]-  timezone, for example: "UTC-2"
  • [[attribute:_country_de]]- country's name in German
  • [[attribute:_country_en]]- country's name in English
  • [[attribute:_country_hu]]- country's name in Hungarian
  • [[attribute:popup_last_seen]] - same property should be used for Embedded Content as well

Custom Visitor Properties

Please refer to this article for information on how to configure OptiMonk to gather data from the custom variables you want to use with Smart tags:

Custom Variables

If you’d like to use cart content data with Smart tags, such as total value or number of items, please read section 3 of this article on Ecommerce Segmentation:

JavaScript code for Cart Rules


3. How do I set up OptiMonk to use Custom Visitor Properties as Smart tags on my site?

OptiMonk gathers the data used for Smart tags through a JavaScript code that is inserted on your site. You define the custom variables you want to use with Smart tags and their value within this code, and then insert the code on your site.


4. How do I use placeholders to customize my campaigns with Smart tags?

DTR can be used with any of our templates, including custom HTML templates. After defining the custom variables or cart content data in the JavaScript code, you have to put placeholders in the text of your popup. The placeholders you use must follow a specific format to enable the system to recognize them, and replace them with the values of your custom variables:

[[type:variable|default value]]

The system will interpret the information between the double square brackets, ‘[[‘ and ‘]]’.

First, the type must be defined. This can either be cart or attribute, depending on whether you would like to use cart data or a custom variable, respectively.

Following the type is a colon, ‘:’, and the name of the variable. The name of the variable must match the one you set in the JavaScript code. It can't contain any special characters, and it’s case-sensitive, meaning uppercase and lowercase letters are interpreted as different characters.

The last part is optional: Following the type is a vertical bar ‘|’ and the text you would like to use as a default value. This default value will be displayed in the event the custom variable is not set, and doesn't return a value to the system.

The following placeholders are available for using cart data:

  • Total value of cart: [[cart:total]]
  • Number of: [[cart:number_of_items]]
  • Number of types of: [[cart:number_of_item_kinds]]

If you have a Shopify website, you will have access to three additional placeholders: 

  • Product name - this can be used on product pages: [[shop:product_name]]
  • Category name - this can be used on category pages: [[shop:category_name]]

The Product name and Category name placeholders are best used with the help of the Current Page / URL Campaign rule.

  • Cart Value Countdown: [[cartValueCountdown:X]] where X is the amount that unlocks the incentive

The Cart Value Countdown is best used with Cart rules, where you target the cart value between a minimum amount (not to show the countdown to everyone, just for those who have something in the cart.) 

Please note:

  • Placeholders can't contain any typos. If your placeholder can't be interpreted by the system, the entire placeholder will show up on the popup.
  • The custom variable name must match the name you set up in JavaScript exactly.

5. An example of a campaign using Smart tags

Let’s look at an example of how to customize a popup with DTR including using the optional entry for the default value. One of the best uses of DTR is to address your visitors by name. You’d like to address all your visitors by name, but you might not have this data for all visitors.

The solution is to use the default value to create a campaign that displays the text 'Dear Visitor' for non-registered users and displays their first name if they are registered.

The first step is to define the custom variable firstname in your JavaScript, and then implement that code to extract the visitor's first name from your database. Please refer to the link to the article on custom variables above. Next, you’ll have to put a placeholder in the text of your popup. This is what the placeholder for our example looks like. We’re using attribute for the type, firstname as the name of our custom variable, and Visitor as the default value.

Dear [[attribute:firstname|Visitor]]!

The below screenshot shows what this looks like in the Campaign editor in your OptiMonk dashboard:


When the visitor is a registered user and their first name is available, the popup will look like this:


When the visitor is not registered or logged in, the system will display the default value we provided in the placeholder.


However, when you haven't specified a default value in the placeholder, and the data is not available, no text will be displayed.


As you can see above, it’s important to define a default value in the event the popup may be displayed to a visitor and the data defined in your custom variable is not available. Otherwise, it may appear that some text or content is missing from your popup.

Using Smart tags will customize your messages for specific visitors. By providing a default value you can make sure your popups continue to be effective for all visitors.

6. Dynamic Country Replacement (DCR)

Dynamic Country Replacement (DCR) allows you to display the country of your website visitors, creating targeted offers that engage your visitors.

You can use DCR with any new or current templates, including custom HTML campaigns. To use DCR in one of your campaigns, all you need to do is to place a special string into the text of the popup:

[[attribute: predefined variables]]

Additionally, you can specify the language in which the country is displayed. Here are the predefined variables which you can use with DCR to control the display language for the country:

To use Hungarian as the display language for DCR in your popup, use the following string:


To use English as the display language for DCR in your popup, use the following string:


To use German as the display language for DCR in your popup, use the following string:


This is what the Campaign will look like in the editor:


In this example, we have set the display language of the visitor's country as English. Let's say we have a visitor from Germany, they will see the following popup:


7. Things to keep in mind when using Smart tags

  • You must pay attention that there is no typo in the used characters. In case you have any typos, the used text will show up instead of the text replacement. 
  • The name of the variable must match the name used in your JavaScript code. It cannot contain any special characters, and it also differentiates between upper case and lower case letters.

That's it! If you have any further questions or need any help, just let us know at and we would be more than happy to assist you :) 

Have more questions? Submit a request