Setting up personalized affiliate links for custom storefronts in the Collabs app
With the Collabs app, you can use personalized affiliate links, such as
mystore.com/sammy, that automatically apply discounts codes during checkout. If you're using a custom storefront, then you need to meet the following requirements to use personalized affiliate links:
- send page view events to Shopify.
- handle URL redirects.
- manage the
/discountroute effectively for automatic discount code application.
If your storefront doesn't meet these requirements, then complete the instructions outlined on this page.
On this page
Sending page view events
The Collabs app uses the same tracking data as the Shopify admin, so your custom storefront needs to send Shopify analytics. To send analytics to Shopify, refer to the Hydrogen documentation.
Confirm that analytics are sent to Shopify
After you send analytics to Shopify, you can confirm that they work by checking the order conversion summary.
From your Shopify admin, go to Orders.
Click any order.
In the Conversion summary section, click View conversion details.
Make sure that the customer's journey started on your custom storefront.
Handling URL redirects
The Collabs app uses your online store URL redirects to create personalized links. You can find a list of your URL redirects from your Shopify admin by going to Online Store > Navigation > View URL redirects.
You need to use Hydrogen's built-in feature
storefrontRedirect utility to handle URL redirects correctly.
Confirm that URL redirects work
To confirm that your custom storefront handles URL redirects, you can open any URL redirect path in your custom storefront, and then verify that the URL redirects to the correct location.
- From your Shopify admin, go to Online Store > Navigation.
- Click View URL redirects.
- Open any URL redirect path in your custom storefront.
- Verify that the URL redirects to the correct location.
Handling the /discount route
The Collabs app uses the
/discount route to automatically apply discount codes for customers.
You can use this example of a discount route implementation from the Hydrogen template to set up and handle the
Confirm that the /discount route is handled correctly
- Go to
- Confirm that you're redirected to
- Initiate a checkout and confirm that the checkout has the
test-discountdiscount code applied.
Change affiliate links domain
After you meet the requirements to set up personalized affiliate links for your custom storefront, you can change the your affiliate links domain.
When you update the domain, all existing affiliate links are updated and all new affiliate links are created with the new domain.
From your Shopify admin, click Settings > Apps and sales channels.
From the Apps and sales channels page, click Shopify Collabs.
Click Open app.
Go to Settings > Affiliates.
In the Storefront domain section, add your custom storefront domain.
In the Link personalization section, select Personalized links.