Linking to your Malomo tracking page in Shopify emails
If you're using Shopify's notifications for events like Shipment Confirmed, Out for Delivery, or Delivered, you can include a link to your tracking page instead of the default order status link from Shopify.
Edit the Shopify notifications with the code below to change where you direct your customers. The code below will not change the look or functionality of the message; it will only direct customers to your new tracking page, instead of the carrier's tracking page.
Steps
1. Identify the base URL for your tracking page. For example, Malomo hosted tracking pages are formatted like this: https://yourbrand.mymalomo.com/xxxxx
. If you've used our Shopify Theme App or Malomo.js to host your tracking page and used a page titled “Order Tracking”; in this case, your base URL would look like: https://yourbrand.com/pages/order-tracking
.
2. Next, navigate to the Settings page in your Shopify Admin and click Notifications. Scroll down and click into the Shipping Confirmation email.
3. Copy and paste the following code at the top (line 1) of the "Email body (HTML)” in Shopify:
{% comment %} START MALOMO {% endcomment %}
{% comment %} Base URL for Malomo tracking page, e.g. "https://example.mymalomo.com" {% endcomment %}
{% assign malomo_base_url = "ADD_BASE_URL_HERE" %}
{% if fulfillment.tracking_company %}
{% capture carrier %}{{ fulfillment.tracking_company }}{% endcapture %}
{% endif %}
{% if carrier and carrier != blank and carrier != "Other" %}
{% capture tracking_url %}{{ malomo_base_url }}/?_m_alt_id={{ order.id }}&_m_tracking_code={{ fulfillment.tracking_numbers.first }}{% endcapture %}
{% elsif order_status_url %}
{% capture tracking_url %}{{ order_status_url }}{% endcapture %}
{% endif %}
{% comment %} END MALOMO {% endcomment %}
4. Replace the example red base URL (https://yourbrand.com/pages/order-tracking
in the HTML above) with your actual base URL.
5. Next search the email code for anywhere that uses this variable: {{ fulfillment.tracking_url }}
and replace it with: {{ tracking_url }}
6. Click Save.
7. Repeat this process for Shipping Update, Out for Delivery, and Delivered emails.