Development discussions around Shopify APIs
I'm trying to integrate a new affiliate network tracking solution with Shopify.
I understand I can pass in URL parameters like ?ref=new_affiliate_partner and access them via {{landing_site_ref}} on the Thank You page https://checkout.shopify.com/orders/nnn/nnnnnnn
But, I don't want to pass additional URL parameters as my affiliate solution appends a specific # value to the end of my links.
I've got some working javascript to set a cookie when I land on my test store with attributes from one of these # fragments, and I'm now trying to figure out how to then access the value of that cookie from the Thank You page.
I've read some forum posts that suggest using CORS but when I tested with the bogus gateway, it didn't add any additional CORS headers to allow me to call back to my own store to retrieve this value.
If this approach isn't going to ever work with the current Shopify architecture, is there an alternative approach via an App or the API that someone can recommend?
Any help much appreciated,
Allan
First off... affiliate parameters are already saved by Shopify and are part of the order. You get the landing page, and any affiliate codes in the order itself. Dealing with cookies and checkout will never be of much use to use since you cannot do anything with checkout. You can inject script code in the Thank You page, and there you do have access to the order in Liquid, so you can get your codes from the order there.
Has nothing to do with CORS since you're dealing 100% with Shopify here and not an external App you control, where cross-domain Ajax might come in handy.
Hi Bill. When you say "affiliate parameters are already saved by Shopify and are part of the order", are you talking about the landing_site_ref feature where you do something ?ref=... ? If not could you give an example of an affiliate parameter that is available as part of the order.
I understand lots of affiliate systems use heavily encoded link tagging and 3rd party cookies. My system tries to use only first party cookies to ensure this will work on mobiles and tablets where the majority of iOS6 users now block 3rd party cookies by default.
I thought CORS might come in handy and the Thank You page is on https://checkout.shopify.com but my shop's 1st party cookie is sitting on myshop.com
If you can explain how I can pass affiliate parameters into my order without using the landing_site_ref feature, that would be awesome.
When you capture the Affiliate code, scraping it out of the URL using Javascript in your theme, you can save it as a cart attribute. Those get passed to the order, and are available for the lifecycle of an order... start to finish, provided a cart exists. And those are not a given until someone puts something in the cart, so you can just save the affiliate code as a cookie till the cart exists and then once it exists, persist the affiliate code as a cart attribute.
You're on your own here, as you can make up dozens of ways of playing with Shopify and this kind of processing. Experiements will lead you to the best choice for you.
Fantastic! That sounds like a great plan of action. Thanks
Got it working perfectly now using a custom cart attribute. Thanks for all your help.
User | RANK |
---|---|
8 | |
6 | |
3 | |
3 | |
3 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By