Skip to main content

Personalize Page Content with Merge Tags and Custom CSS

Written by Harneet Kaur

Plan: All plans (merge tags); Premium, Enterprise (custom CSS)

Platform: E-commerce platforms, Commerce API, Tracking API, and CSV import

Applies to: Tracking pages only. The Returns and Warranty editors don’t have merge tags or custom CSS.

Overview

Merge tags and custom CSS let you go beyond the standard settings on a Tracking page.

  • Merge tags put order- and shipment-specific information into your copy.

  • Custom CSS changes how the page looks past what the style controls expose.

Learn how to personalize your Tracking page content using Branded pages in AfterShip. This guide walks you through adding merge tags, adding custom CSS to the entire page, and adding custom CSS to a specific section. Once live, one piece of copy produces a personalized line for every shipment, and your page matches your brand beyond the default theme settings.

Before You Begin

Requirements

  • Some knowledge of CSS and HTML, if you plan to add custom CSS

Limitations

  • Merge tags and custom CSS work on Tracking pages only; the Returns and Warranty editors don't have them

  • Page-level custom CSS has a limit of 1,500 characters

  • Section-level custom CSS has a limit of 500 characters

Step 1: Add a Merge Tag

Merge tags are placeholders that insert specific tracking or order information into the page when a shopper opens it, such as the carrier's name or phone number. One piece of copy produces a personalized line for every shipment.

  1. Go to Branded pages in AfterShip.

  2. Find the Tracking page, and click Edit pages.

  3. In the Sections panel, select the section or block where you want the tag (for example, Header message), and open the message or description for editing.

  4. In the text toolbar, click the {···} icon.

  5. Pick a tag from the list, or type in the search box to filter it.

  6. Click Save.

Insert merge tag menu in the text toolbar

Where you can insert merge tags

Section / block

Field

Text

Description (also the Text blocks inside Custom sections, the Order lookup page, and the In-store pickup page)

Header

Store URL; Menu item URLs

Header message

Description

Footer message

Description

Shipment status > Status names and descriptions

Description (each status, including error statuses and in-store pickup statuses)

Shipment alerts

Message

Image with text

Description, URL link

Image

Destination URL

The Product recommendations section has one special tag of its own: DISCOUNT, used in the discount value text.

List of available merge tags

Merge tag

Description

Tracking number

The shipment's tracking number.

Last mile tracking number

The last-mile carrier's tracking number in multi-leg shipments.

Carrier name

The carrier's name.

Last mile carrier name

The last-mile carrier's name in multi-leg shipments.

Carrier tracking link

The carrier's tracking URL.

Last mile carrier tracking link

The last-mile carrier's tracking URL in multi-leg shipments.

Carrier redirect link

A URL that redirects the parcel to a different carrier.

Last mile carrier redirect link

The URL that redirects the parcel to the last-mile carrier.

Carrier email address

The carrier's email address.

Last mile carrier email address

The last-mile carrier's email address.

Carrier phone number

The carrier's phone number.

Last mile carrier phone number

The last-mile carrier's phone number.

Order number

The order number associated with the shipment.

Order id

The order's ID.

Shipment title

The shipment's title.

Custom fields

Custom fields you created via API, CSV, or Admin. The picker lists the custom field keys found on your shipments from the last 120 days.

For example, a custom field named store_name lets you write "Your order from STORE_NAME is on the way."

When a merge tag has no value

The merge tag shows the fallback value set in your content preferences. Only when no fallback is set does the merge tag resolve to nothing. Set fallback values in Set content preferences: data formats, fallback values and tracking page privacy, then write your sentence so it still reads correctly with the fallback in place.

Custom CSS

Custom CSS allows you to personalize your Tracking page to better reflect your brand, beyond the default theme settings. You can apply custom styles to the entire page or to specific sections.

Please note that customizing CSS requires basic knowledge of CSS and HTML. Errors in your code may affect how your page is displayed.

Custom CSS rules

Custom CSS overrides your theme settings, so anything you add takes precedence over the built-in styles. Errors in the code can cause display issues on your page. Keep the following in mind.

1. CSS rules and constraints

  • Custom CSS supports only the @media and @font-face at-rules.

  • Page-level CSS doesn't support id selectors or class selectors.

  • For section-level CSS, styles you apply in the editor target the outermost level of the section.

  • For section-level CSS, you can use the provided id selectors, class selectors, and tag selectors. Type # or . in the editor to see the available id and class selectors. The supported tags are input and img.

  • Some sections don't support id and class selectors because of their structure, which limits the available selectors.

  • CSS variables can't use --btp as a prefix.

2. Font usage

  • Custom CSS accepts URLs from https://fonts.googleapis.com only. If you need another URL, contact us for evaluation.

  • Custom fonts aren't restricted, but they are separate resources the browser downloads before rendering text, which can affect page performance. Make sure custom fonts don't slow your page down.

3. Selector hierarchy

  • If you apply a rule to a tag that wraps the parent section element, the rule counts as a descendant tag and the style applies to that section. By default, a <div> tag wraps the parent section.

4. Combinatorial selectors

  • You can use combinatorial selectors, but use them cautiously. Complex selectors make issues harder for us to resolve.

If you hit an error related to these limitations and can't tell what's causing it, contact us for help.

Step 2: Add Custom CSS to the Entire Page

Page-level CSS affects every section of the page, for instance how images appear throughout. Page-level CSS has a limit of 1,500 characters.

  1. Go to Branded pages in AfterShip, find the Tracking page, and click Edit pages.

  2. Open the Branding tab in the left rail.

  3. Scroll to Custom CSS at the bottom of the panel and turn on its switch.

  4. Decide what you want to change, prepare the CSS, and paste it into the code box.

  5. Click Save.

For example, to add a 2px green border to every image with 8px rounded corners and a subtle shadow:

img {
border: 2px solid #4CAF50; /* Adds a green border */
border-radius: 8px; /* Rounds the corners of the images */
max-width: 100%; /* Ensures images are responsive */
height: auto; /* Maintains aspect ratio */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Adds a subtle shadow */
}

Custom CSS at the bottom of the Branding panel

Warning: Custom CSS takes priority over every other style setting, so use it only to change fonts, colors, backgrounds, and section layouts. Other changes could harm how the page works.

Step 3: Add Custom CSS to a Specific Section

Section-level CSS applies only to the selected section, for instance a different font color or background for that area. Section-level CSS has a limit of 500 characters.

  1. Go to Branded pages in AfterShip, find the Tracking page, and click Edit pages.

  2. In the Sections panel, select the section you want to style.

  3. Open the section's Style tab and scroll to Custom CSS at the bottom.

  4. Prepare the CSS and paste it into the code box.

  5. Click Save.

For example, to give the product recommendation title a red background, 20px of padding, 10px rounded corners, and a subtle black shadow at 10% opacity:

.as-btp__product-recommendations-title {
background-color: #ff0000; /* Red background */
padding: 20px; /* Adds padding around the section */
border-radius: 10px; /* Rounds the corners */
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}

Section-level Custom CSS at the bottom of a section's Style tab

Class selector usage

The .class selector targets elements with a specific class on the page or within a section. Each section, and the page as a whole, supports only a limited set of auto-generated class selectors. Type a period (.) in the code box to list all available classes.

Typing a period in the code box lists the available class selectors

This restriction exists because custom CSS allows significant customization. Without limits, custom CSS could complicate future maintenance or harm the functioning and layout of your page.

More things you can do with custom CSS

1. Overlay fade

Overlay fade

2. Gallery with horizontal scroll

Gallery with horizontal scroll

3. Image grid

Image grid

What You and Your Shoppers Will Experience

After completing these steps:

  • Shoppers see their own order and shipment details, such as the carrier name or tracking number, in place of each merge tag

  • Shoppers see the fallback value from your content preferences when a merge tag has no value

  • Shoppers see your page-level custom CSS across every section of the Tracking page

  • Shoppers see your section-level custom CSS on the selected section only

  • Your custom CSS takes precedence over the built-in theme styles

FAQs

1. Can I use merge tags or custom CSS on Returns or Warranty pages?

No. Merge tags and custom CSS work on Tracking pages only. The Returns and Warranty editors don't have custom CSS or merge tags.

2. What does a merge tag show when there's no value?

The merge tag shows the fallback value set in your content preferences. If you haven't set a fallback, the merge tag shows nothing.

3. Which custom fields can I use as merge tags?

You can use custom fields you created via API, CSV, or Admin. The picker lists the custom field keys found on your shipments from the last 120 days.

4. Can I use fonts from a URL other than Google Fonts?

No. Custom CSS accepts URLs from https://fonts.googleapis.com only. If you need another URL, contact us for evaluation.

5. Why can't I use any class selector in my custom CSS?

Each section, and the page as a whole, supports only a limited set of auto-generated class selectors. Without limits, custom CSS could complicate future maintenance or harm the functioning and layout of your page.

Key takeaways

  • Merge tags insert order and shipment details into your Tracking page copy when a shopper opens the page

  • Use page-level CSS for every section (1,500 characters) or section-level CSS for one section (500 characters)

  • Merge tags and custom CSS work on Tracking pages only, not on Returns or Warranty pages

  • Shoppers see their own shipment details in place of each merge tag, or your fallback value

  • Custom CSS overrides theme settings, so limit it to fonts, colors, backgrounds, and section layouts

Did this answer your question?