Skip to main content

Embed pages into your store using an iframe

Written by Harneet Kaur

Plans: Premium, Enterprise

Platforms: All platforms

Applies to:Tracking pages, Returns pages

Overview

Embed using iframe places your AfterShip Tracking or Returns page inside a page on your own site, so your header, navigation, and footer stay around it. Learn how to embed your Tracking or Returns page using AfterShip. This guide walks you through getting the Tracking page iframe code, getting the Returns page iframe code, pasting the code into your site, and checking the embedded page. Once live, shoppers never appear to leave your store.

Before you begin

Requirements

  • Edit access to the page on your site where the AfterShip page should appear

Limitations

  • The URL doesn’t change as the shopper moves through the flow, so shoppers can’t bookmark or share a particular step, and your analytics see a single page

  • The browser Back button follows your site’s history, not the embedded page’s history

  • Some browser privacy settings restrict embedded content

  • Your own page must handle deep links into a particular step, since the iframe source is fixed

Step 1: Get the Tracking page iframe code

Set what the iframe points to and who can host it, then copy the code.

  1. Go to Branded pages > URLs and embedding.

  2. Open Embed using iframe.

  3. Under Tracking page iframe, choose what the iframe points to:

    • Default page or follow segmentation rules: if you haven’t set up segmentation, the iframe shows your default Tracking page. If you have, each shopper sees the page whose rules they match.

    • Specific page: every shopper sees the one Tracking page you pick.

  4. Under Domain access, choose which domains can host the iframe:

    • Allow embedding on any domain: Any domain can host tracking pages using iframes

    • Only allow embedding on specific domains: Only allowlisted domains can host tracking pages using iframes. Click Add domain, then add each domain the iframe appears on.

  5. Click Copy iframe code.

Embed using iframe settings in Page insertion, with the Tracking page iframe options shown

The Embed using iframe settings in URLs and embedding

Important: Copy the code after you set what the iframe points to. The code includes that setting.

Step 2: Get the Returns page iframe code

The Returns page iframe loads only on domains in your allowlist, so add the host domain before you copy the code.

  1. Click Add domains to allowlist.

  2. Enter the domain of the site that hosts the Returns page.

  3. Save your changes.

  4. Copy the Returns page iframe code.

Adding a domain with Add domains to allowlist

Step 3: Paste the code into your site

Add the iframe code to the page on your site where the AfterShip page should appear.

  1. Open the page on your site where the AfterShip page should appear.

  2. Paste the iframe code.

  3. (Optional) Change the width and height values in the code.

Step 4: Check the embedded page

Test the embedded page before shoppers use it, since height, width, and layout issues are common.

  1. Height: Open a shipment with a long history in the embedded Tracking page. Tracking page height varies with shipment history and status, so a fixed iframe height can cause an inner scrollbar or a large empty gap.

  2. Responsiveness: Open the page on a real phone. Your site’s header and footer plus the embedded page can leave very little room on mobile.

  3. Width: Open the page on a desktop screen. A narrow container forces the page into its mobile layout.

  4. Custom CSS style: Review the layout rules on the container. Styles on your site shouldn’t reach inside the frame, but container layout rules often cause problems.

  5. Browser extensions: Open the page in a private window and in Safari.

To stop embedding the page, remove the iframe code from your site.

What your users will experience

After completing these steps:

  • Shoppers see your AfterShip page inside your site, with your header, navigation, and footer around it

  • Shoppers stay on your store throughout the tracking or returns flow

  • Shoppers see the Tracking page you set in Tracking page iframe: your default page, the page their segmentation rules match, or the specific page you picked

  • Your Returns page loads only on domains you add to the allowlist

The branded returns portal on its own


​

The same portal embedded in the store

Troubleshooting

Problem

Cause

Solution

My Returns page doesn’t load in the iframe

The host domain isn’t in the allowlist

Click Add domains to allowlist, add the domain, and save.

My Tracking page doesn’t load on my site

You chose Only allowlisted domains can host tracking pages using iframes and didn’t add the domain

Click Add domain and add the domain that hosts the iframe.

My embedded page looks cut off or has a large empty gap

The iframe has a fixed height, but Tracking page height varies by shipment

Change the height value in the code, then test with a shipment that has a long history.

My embedded page shows the mobile layout on desktop

The container on your site is too narrow

Give the container more width.

My embedded page doesn’t load in Safari

Browser privacy settings restrict embedded content

Test in Safari and a private window, or use a custom domain or the Shopify proxy URL instead.

My iframe still shows the old Tracking page after I changed the settings

The copied code includes the settings from when you copied it

Copy the iframe code again and replace the code on your site.

FAQs

1. Which AfterShip pages can I embed using an iframe?

You can embed Tracking pages and Returns pages. Warranty pages don’t offer an iframe embed, so use a page URL or custom domain instead.

2. Should I use an iframe, a custom domain, or the Shopify proxy URL?

Use an iframe when the page needs to live inside your existing site, with your navigation, your account menu, or a specific layout a standalone page can’t reproduce. If you don’t need that, a custom domain or the Shopify proxy URL is simpler and avoids the iframe limitations.

3. Do I need to copy the iframe code again after I change the Tracking page settings?

Yes. The code includes the settings from when you copied it, so copy the code again and replace it on your site.

4. Can I limit which websites host my Tracking page?

Yes. Under Permissions, choose Only allowlisted domains can host tracking pages using iframes, then add each domain.

Key takeaways

  • An iframe places your Tracking or Returns page inside your site, keeping your header, navigation, and footer

  • Set what the Tracking page iframe points to before copying, because the code includes that setting

  • Tracking and Returns pages support iframe embedding; Warranty pages don’t

  • Shoppers see your AfterShip page within your store and never appear to leave it

  • The Returns page iframe loads only on domains you add to the allowlist

Did this answer your question?