I'm attempting to programmatically retrieve the number of visitors I've had from instagram on my shop. The information is easily accessible through the analytics dashboard in shopify, but I can't seem to get the information through either the graphql api or the rest api.
From what I can tell, the graphql api does not have this information at all, but the rest API should. My problem is that I cannot figure out how to get the analytics token that is required to send with the request.
This is the specific request I need, which I got from the chrome dev tools of https://my-shop.myshopify.com/admin/reports/sessions_by_referrer?startDate=2019-03-29&endDate=2019-0...:
https://analytics.shopify.com/queries?beta=true token: HOW_DO_I_GET_THIS? q[]: SHOW+total_visitors+AS+%22total_visitors... source: shopify-reports
I have copied this request to postman and it works fine, as long as I use the token that I got from the chrome dev tools request. I just need to know how to get the analytics token programatically. Thanks!
I think if you have a private app it should work with your secret. However, I am not sure. Please try and give updates!
hi,did you resolved the problem , i have the same question. can you tell me how to acquire the token ? thanks in advance.
I never did resolve the issue. From what I can tell, in order to get a token you have to be subscribed to the Shopify Plus plan (the $300/month plan), so perhaps that is why I wasn't able to get a token.
If you go to the analytics page in the admin console and inspect the network with your browsers dev tools you can see the token. You can then take that token and make your own requests with it. However, I don't know of a way to get that token without a hack like this.
It's really frustrating, and I ended up just moving on from the project I was trying to complete.
Hi, I have also the same problem?Anybody resolve this or not?Please tell me
@demonhuntervn wrote:ok. thanks for your reply ! If i find a way, i will reply
Hi,
We have managed to get number of visitors from different sources using this graphql "edge": https://shopify.dev/docs/admin-api/graphql/reference/object/order/customerjourney?api[version]=2020-...
The firstVisit/lastVisit holds information about where the customer comes from. BUT this is of course not the all the visits, only the visits that generated an order. We have not found a way to track all the visits through the API. I guess you can use google analytics for that or similar.
Anyway, using the "analytics" API that the admin dashboard is using would solve a lot of our problems. Thats the numbers that our clients usually compare the data we can get from the graph QL with. And its hard to get those numbers to match...
Does that answer your question?
/Antonio at Funnel
User | Count |
---|---|
12 | |
11 | |
10 | |
8 | |
7 |