Search code examples
rhexshopifymatomo

Is there a way to decode the hex string in the Shopify order complete URL?


I'm running Matomo to get clickstream data from a Shopify ecommerce site and rather than going through the pain of getting ecommerce tracking working I'd like to extract the order-id from the thank-you URL. I can then join the clickstream data to ERP order details.

An example URL is:

https://example.com/123456789/orders/d85e0fcf1a7e9e1c3c441c0777326775

... where d85e0fcf1a7e9e1c3c441c0777326775 is an actual order number.

I tried to do a standard hex decode, but the result was garbage.

Thanks.


Solution

  • Looks like the hash isn't standard encryption. It is however the order_hash presented through the Shopify orders REST API. I ended up creating a private Shopify app and using the shopr R package to get the order data which includes the order_hash. The order hash can be extracted from the Matomo data URL as above and joined.