我正在创建一个 Shopify 应用程序,我将从后端查询 Shopify 网站上的订单,以检测我的网站引用的订单。
我在引导用户访问的初始页面上使用 utm 参数,并且它们一直正确传递到 order_completed。我可以在订单的 customerJourney 中获取 utm 参数。
挑战在于我只想获取与我相关的订单,因为查看商店的所有订单会导致数据泄露。有没有办法在 GraphiQL 过滤器中实现这一点?如果没有,您以其他方式实现这一目标的指导是什么?
类似于下面的内容,但查询似乎没有正确过滤。 utm 的替代方案,我可以使用referralCode,但过滤问题仍然存在......
{
orders(
first: 100
query: "created_at:>='2024-02-21' AND customerJourney.moments.utmParameters.source:test_keyword"
reverse: true
) {
edges {
node {
name
id
createdAt
channelInformation {
id
}
currentTotalPriceSet {
presentmentMoney {
amount
}
}
customer {
id
}
customerJourneySummary {
firstVisit {
landingPage
}
lastVisit {
landingPage
}
}
customerJourney {
moments {
... on CustomerVisit {
utmParameters {
source
campaign
content
medium
term
}
}
}
}
}
}
}
}
这是不可能的,目前这些是您在查询订单时可以使用的唯一过滤器(从这里https://shopify.dev/docs/api/admin-graphql/2024-01/queries/orders) :
如果这些字段都无法帮助您,我建议您使用 Flow 标记订单(您应该能够在那里使用买家旅程),然后搜索该标签。