Plan: All plans
Platform: All platforms
Applies to: Tracking pages
Overview
The order lookup widget, also called the Track button, is a lookup form you place on your own storefront. Shoppers enter their order or tracking number without leaving your site, and the widget takes them to your tracking page.
Learn how to set up the order lookup widget using AfterShip Tracking. This guide walks you through configuring the widget settings and style, installing the code on your store, adjusting the code by hand, and testing it. Once live, shoppers look up orders from the pages they already visit, which measurably more shoppers complete than a menu link to an empty lookup page.
Before you begin
Requirements
An active Tracking page in Branded pages
A store page or template that accepts custom HTML
Permissions
Access to Branded pages > URLs and embedding in AfterShip
Access to edit your store theme or page HTML
Limitations
The button label accepts letters, numbers, hyphens, and underscores only, with no spaces
Removing the "Powered by AfterShip" footer isn't included in every account
The
data-slugattribute works only whendata-domainistrack.aftership.comThe
data-responsiveanddata-widthattributes have no control in the settings panel, so you set them in the code
Step 1: Open the order lookup widget settings
Open the widget settings so you can configure the widget with a live preview.
Go to Branded pages > Page insertion.
Open the Order lookup widget tab.
Use the live preview to check each change as you configure the settings.
The Order lookup widget tab in URLs and embedding
Step 2: Choose the lookup options and landing page
The lookup option sets what shoppers enter, and the landing page sets where shoppers go after they submit.
Under Lookup options, select what shoppers enter:
Order number and email: the store order number and the email the shopper placed the order with
Tracking number: only the tracking number
Both: shoppers can use either one. This is the default.
Under Landing page URL, select where shoppers go after they submit:
Use universal URL: your default Tracking page, or the page that matches your segmentation rules. This is the better default, because you can change routing later without pasting the code again.
Use a specific page variation: one Tracking page for everyone, regardless of rules. The generated code then carries that page name in
data-domain(…?page-name=…).
Tip: Match the lookup option to what your notifications give shoppers. If your emails show an order number, don't ask for a tracking number.
Step 3: Set the tracking number and branding options
Pre-fill the tracking number on pages where you already know the order, and decide whether to show the AfterShip credit line.
Under Tracking number, select Pre-input tracking number to pre-fill the field. Use it on an order detail page where you already know the order, so the shopper only has to click. This option is available only when the lookup option is Tracking number, and switching the lookup option clears it.
(Optional) Select Hide tracking number to hide the pre-filled number, so the shopper sees only the button. This option is available only after you pre-input a tracking number.
(Optional) Under AfterShip branding, select Remove "Powered by AfterShip" footer to drop the credit line under the widget.
When you select Pre-input tracking number, the generated code contains the placeholder TRACKING_NUMBER. Replace it with your platform tracking-number variable, as described in Step 7.
Note: If the panel shows Upgrade and unlock instead of the checkbox, removing the footer isn't included in your account yet.
Step 4: Style the widget
Match the widget size, alignment, and button to your store theme.
Under Overall style, select a Size: Large, Medium (default), or Small.
Select an Align option: Left or Center (default).
Under Button, enter a Label for the button text, up to 20 characters. The default is Track.
Enter 6-digit hex values in Background color and Text color to match your theme exactly. The defaults are
#ff6b2band#ffffff.(Optional) Select Hide icon to remove the AfterShip icon from the button.
The Order lookup widget style settings
Important: The label accepts letters, numbers, hyphens, and underscores only, with no spaces. Track-order works, but Track order doesn't: the field shows an error and the code drops the label.
Step 5: Choose where to place the widget
Place the widget where shoppers already look for order updates.
Pick one or more pages for the widget:
Header or footer: always reachable, and where shoppers look first
Order confirmation page: the moment shoppers most likely want it
Account and order history pages: with the tracking number pre-filled, tracking takes one click
Help and FAQ pages: answers the question at the point shoppers ask it
Note the template or page for each location, so you can paste the code there in Step 6.
Step 6: Install the widget code
Paste the two pieces of code into your store so the widget appears.
Click Install. The Install your widget dialog shows two pieces of code, CODE1 and CODE2, each with a Copy code button.
The Install your widget dialog with the two code snippets
Paste CODE1 into your page right after the
<body>tag. CODE1 is the loader: a<div id="as-root">plus the script that fetches the widget.Paste CODE2 between the
<body>and</body>tags, exactly where the button should appear. CODE2 is the<div class="as-track-button" …>element that becomes the widget.
Paste the code into your store page
Save the page.
Open the page as a shopper to check the widget.
The widget on a store page
The code is plain HTML, so the instruction is the same on every platform: open the template where the widget should appear and paste the code in.
Shopify: go to Online Store > Themes > Edit code and paste into the relevant template or section, or open a page in Online Store > Pages and use the HTML editor
WooCommerce, Magento, BigCommerce, PrestaShop, CS-Cart, 3dcart.
Note: If your platform isn't listed, paste the code anywhere your platform accepts custom HTML.
Step 7: Adjust the widget code by hand (optional)
Every setting in the panel is also a data-* attribute on the as-track-button element, so you can change an installed widget without generating the code again. A few attributes have no control in the panel, and you can set them only in the code.
Open the store page or template that contains CODE2.
Edit the
data-*attributes on theas-track-buttonelement, using the table below.Save the page.
Parameter | Type | Description |
| String |
|
| String | Domain of the tracking page: |
| String | Button text, under 20 characters, using letters, numbers, hyphens, and underscores only. Default |
| String | Button background color, 6-digit hex. Default |
| String | Button text color, 6-digit hex. Default |
| Boolean | Hides the AfterShip icon: |
| String |
|
| String | Makes the widget mobile responsive: |
| Number | Width in px, for example |
| String | A carrier code. If you omit it (default), AfterShip detects the carrier automatically. Works only when |
| String | Pre-filled tracking number for one-click tracking. Applies only when the lookup option is |
| Boolean | Hides the pre-filled tracking number. Applies only with |
| Boolean | Centers the widget: |
| String | Removes the "Powered by AfterShip" footer. The value is a token AfterShip generates from your domain when you select the setting, so you can't type it by hand. Generate the code again to change it. |
Keep these rules in mind when you edit by hand:
The generated code writes booleans without quotes, for example
data-hide-icon=trueThe generated code includes only the attributes that differ from the defaults, so a missing attribute means the default value
Center the button. The generated code already includes data-center="true" when Align is Center. Wrapping the code in <center>…</center> also works.
Pre-fill the tracking number on an order history page. With Pre-input tracking number selected, the generated code contains data-tracking-number="TRACKING_NUMBER". Replace that placeholder with your platform tracking-number variable, so the shopper tracks in one click:
<div class="as-track-button" data-size="small" data-domain="yourbrand.aftership.com" data-tracking-number="12345678"></div>
Point the widget at your own domain. If you change your organization short name or set up a custom domain, update data-domain on every page where you installed the widget, for example storeabc.aftership.com or track.storeabc.com.
Step 8: Test the widget
Check the widget as a shopper before you rely on it.
Submit a real order number and confirm that the widget lands on the right tracking page.
Submit an invalid number and check that the error message is understandable.
Check the widget on mobile. Widgets that look fine on desktop frequently overflow a phone header.
To remove the widget, delete CODE1 and CODE2 from your store pages and save.
What your users will experience
After completing these steps:
Shoppers see the Track button on the store pages where you pasted the code
Shoppers enter an order number and email, a tracking number, or either one, based on your lookup option
The widget takes shoppers to your universal Tracking page or the page variation you selected
On pages with a pre-filled tracking number, shoppers track their order in one click
You change the widget later by editing its
data-*attributes, without pasting new code
Troubleshooting
Problem | Cause | Solution |
The Track button shows the default label instead of mine | The label contains a space or a character other than letters, numbers, hyphens, and underscores, so the code drops it | Replace spaces with hyphens or underscores, for example |
The Track button stopped working after I changed my short name or domain |
| Update |
The widget ignores the carrier I set in |
| Remove |
I can't select Pre-input tracking number | The lookup option isn't Tracking number | Set Lookup options to Tracking number |
I see Upgrade and unlock instead of the branding checkbox | Removing the footer isn't included in your account yet | Upgrade your account to unlock Remove "Powered by AfterShip" footer |
The widget overflows my store header on mobile | The widget is too wide for the phone layout | Keep |
FAQs
1. Is the order lookup widget the same as the Track button?
Yes. The order lookup widget and the Track button are 2 names for the same lookup form.
2. Why use the widget instead of a menu link to my tracking page?
A menu link drops the shopper on an empty lookup page. The widget puts the form where shoppers already are, and measurably more shoppers complete it.
3. Can I change the widget without installing the code again?
Yes. Edit the data-* attributes on the as-track-button element. To change data-remove-brand, generate the code again, because its value is a token AfterShip creates from your domain.
4. Which lookup option does the widget use if the attribute is missing?
The widget uses tracking-number. The settings panel defaults to Both.
5. Does data-slug work on my own domain?
No. The widget honors data-slug only when data-domain is track.aftership.com. On your own domain, AfterShip detects the carrier automatically.
6. Can I add the Track button to a store that isn't on Shopify?
Yes. The code is plain HTML, so it works anywhere your platform accepts custom HTML.
Key takeaways
The order lookup widget lets shoppers look up orders from your storefront and lands them on your tracking page
The lookup option should match what your notifications show shoppers: order number, tracking number, or both
The widget works on every plan and platform that accepts custom HTML
On order history pages with a pre-filled tracking number, shoppers track in one click
The code drops button labels that contain spaces, so use hyphens or underscores instead




