Traffic referrer source via Shopify Admin API GraphiQL

Highlighted
Tourist
18 0 0

I'm using Shopify Admin API GraphiQL for fetching orders.

Looking for easy way to retrieve the traffic referrer source (Direct, Search, Social, Unknown...)

Didn't found relevant 'order' native field.

 

The closest solution that I found is to use the customerJourney -> first/lastVisit -> sourceType:

if no customerJourney -> Direct

if source is direct -> Direct

if sourceType is null -> Unknown

if sourceType is SEO -> Search

 

The problem start when the 'source' is Facebook and the 'sourceType' is null...

(Should  be something close to "Social")

 

Thanks for helping!

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

Hey @Amichay ,

 

You are correct that if you want to the best way to get information about a referrer source in the GraphQL Admin API, you should use the resource of "customerJourney.lastVisit.source". This field gives the source from which the customer visited the store, such as a platform (Facebook, Google), email, direct, a website domain, QR code, or unknown.

 

With regards to "customerJourney.lastVisit.sourceType" specifically, you can find the list of all possible values here: https://shopify.dev/docs/admin-api/graphql/reference/object/marketingtactic. As you can see from this list, "Social" is not a valid type that Shopify records. If it came from a Facebook ad we would say "Ad" as the source type, or if it came from a Facebook link we would say "Link" as the source type.

 

  

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Tourist
18 0 0

Hi hassain,

 

I Will ask it in other way.

The report that I want to mimic is "Sales by traffic referrer".

The column that I have an issue to find is traffic referrer source (and as you see Facebook is Social...).

Please direct me to the right fields in the Shopify Admin API.

 

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

Hey @Amichay ,

 

Since the data from Shopify Analytics is pulled from their own unique sets of database tables with their own separate schemas, you might not be able to pull the same identical information as it from the Admin API. 

 

If your store is on Shopify Advance plan or Shopify Plus, I'd recommend using the Shopify Analytics API to pull the report directly or use Shopify Query Language to make your own reports:

https://shopify.dev/docs/admin-api/rest/reference/analytics

https://shopify.dev/docs/admin-api/rest/reference/analytics/report

https://shopify.dev/tutorials/get-store-metrics-with-analytics-api

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes