# How to Use Smart Tags - Dynamic Text Replacement

Popupsmart provides an easy way to display dynamic texts on your popup campaigns using the Smart Tags feature. Create personalized onsite marketing messages with dynamic content to improve conversions.

# What Are Smart Tags?

Smart tags make it possible to add dynamic text to your popup campaigns. For example, you can address visitors by their names or show their location automatically using a specifically formatted placeholder text.

# Add a Smart Tag to Your Campaign

# 1. Edit a text element in the popup builder such as the Headline or Description.

  • Dynamic text replacement works in headlines, descriptions, sub-descriptions, input fields, and also for success and teaser popups.

editing headline on popup builder screen

# 2. Copy-paste or write a predefined/custom smart tag in curly braces such as {{Name}}.

  • You can find our predefined Smart Tags at the end of this page.

adding a dynamic text on popup

# 3. Optionally, define a default value to use for the Smart Tag if the tag can’t find the necessary data: e.g., {{Name|fall=You}} so that when there’s no data to pull, the defined default text “You” will fall instead.

  • Note that the default text replacement or the “fall” attribute is optional. If you don’t use it and there’s no variable data about the user, then the dynamic text simply won’t show. For example, “Hey {{Name}}” will appear as “Hey.”

smart tag in headline

# 4. Once the popup is live and published, the Smart Tag will be shown as the dynamic value you have set.

dynamic popup text example

# How Smart Tags Work

Popupsmart’s Smart Tags feature works in a campaign’s headline, description, sub-description, input fields, and also for success and teaser popups. Additionally, smart tags can be added to the hidden input fields for purposes like collecting data.

You can feed the Smart Tag data in two different ways; JavaScript API and URL parameter.

# 1. URL Parameters for Dynamic Text Replacement

URL parameter fills in the data when it is, for example, “examplewebsite.com/?name=firstname”.

As you might know, most URL parameters contain user information such as order ID, product ID, or even user name. If we go back to square one, URL parameters are query strings. Let’s take a look at the anatomy of a URL parameter for better understanding.

anatomy of a URL

So, for example, when the URL parameter is something like domain.com/?name=firstname, then the Smart Tag ({{Name}}) transforms into the name data in the query string.

Go to your Popupsmart dashboard to create/edit a campaign. On your popup builder screen, enter the smart tag variable name in curly braces into the field you wish to show a dynamic text.

  • By default, Popupsmart works with 4 main variables which are the most common ones:

    {{utmCampaign}}: "",

    {{utmSource}}: "",

    {{utmMedium}}: "",

    {{utmContent}}: ""

Important: If you need to define another custom variable, then you can do so by defining it as metadata on GTM.

Some parameters like the {{Name}}, can be found through email marketing services. Since you already know your subscribers’ names and other information, you may show them a personalized popup.

Just add the dynamic text to your popup and set up URL targeting to show on that specific page. Then, link the URL to your email button. Your subscribers who click on your email button will be directed to the page with the personalized popup.

# 2. Using JavaScript API for Dynamic Text Replacement

On the other hand, JavaScript API functions as “psMetaData.add({ name: })

Apart from these, smart tags can also be fed with the data coming from system fields, which are automatically created by browsers.

# Defining a Smart Tag using Google Tag Manager

# Step 1: Go to GTM and click on Add a New Tag.

adding new tag on GTM

# Step 2: Click on Tag Configuration and choose your tag type as Custom HTML Tag.

Custom HTML tag type

# Step 3: Enter the snippet code as below. Note that you can set up the variable types as you need; this is only an example.

<script> psMetaData.add({ name:  }) </script>

tag configuration

# Step 4: Click on Triggering and the “+” sign to add a new trigger.

adding new trigger

# Step 5: Then, click on Trigger Configuration and select Window Loaded from the opening sidebar as seen below.

window loaded trigger

# Step 6: There are two options you may choose; All Windowloaded Events or Some Window Loaded Events.

  • If you choose “some,” then you need further configuration to use this trigger only on specific Page Hostname, URLs, Paths, or Referrers. Additionally, you have the option to choose a built-in variable or add a new variable.

  • If this feels advanced to you, just select All Windowloaded Events.

# Smart Tag Format

Every smart tag or dynamic text must start and end with two curly braces. This determines the text you want to replace inside your popup campaign.

  • The first value needs to be either a predefined smart tag or the name of a custom variable you have defined.

    {{SMART_TAG_NAME}}

  • To show a default text in case the smart tag cannot pull necessary data, use a pipe character (|) and “fall=” followed by the text you want to use.

    {{SMART_TAG_NAME|fall=DEFAULT_TEXT}}

# Predefined Smart Tags/Dynamic Texts

  • The following are predefined smart tags available to use right on your Popupsmart popups. The text following a colon ( : ) is for exemplary purposes of how the dynamic content will look.

    {{ip”: “3.23.78.141}},

    {{date_MM_dd_yyyy}}: “03/05/2021",

    {{date_MMMM_dd}}: “May 03",

    {{date_dddd_dd_MMMM_yyyy}}: “Monday, 03 May 2021",

    {{country}}: “United States”,

    {{region}}: “Ohio”,

    {{city}}: “Ohio”,

    {{countryCode}}: “US”,

    {{language}}: “Turkish”,

    {{os}}: “Mac OS X 10.15",

    {{browser}}: “Chrome 90.0",

    {{referrer}}: “”,

    {{utmCampaign}}: “”,

    {{utmSource}}: “”,

    {{utmMedium}}: “”,

    {{utmContent}}: “”

Note: These tag names are reserved names (e.g., {{language}}) and should not change.

Still have questions? Contact us via live chat or email us at [email protected]