Does an API for getting number of sessions or visitors exist?

Does an API for getting number of sessions or visitors exist?

LouiseEH
Shopify Partner
36 3 4

Hi,

 

I've been looking into the ShopifyQL API c.f. https://shopify.dev/docs/api/shopifyql in relation to getting the number of sessions or the number of visitors for a given time period.
As far as I can see, you can only query data about orders, products or payments in the ShopifyQL API. For products you can query different metrics about sessions e.g. view_sessions and cart_sessions, but always in relation to the product as opposed to sessions or visitors in general.
From previous posts it looks like there might have been a session metric in the ShopifyQL API earlier on, but not anymore. Or maybe I can find the information in another API entirely?

Kind regards,
-Louise

Replies 10 (10)

made4Uo
Shopify Partner
3840 716 1177

The ShopifyQL API does not include user sessions. However, you can definitely use other language to detect users and log sessions

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
InnaB
Visitor
3 0 0

What would be a good workaround?

When talking about "sessions"  usually what people here are referring to is even aggregated data about how  many times a product page has been viewed.Is that possible?

What about creating a developer app for shopify plus merchants that will call shopifyql API?

There is documentation saying that there might be a way, for example:

https://shopify.dev/docs/api/shopifyql/datasets/products-dataset

LouiseEH
Shopify Partner
36 3 4

Hi InnaB,

 

Thank you for your reply.
Yes I did see the products dataset in ShopifyQL, but it only refers to sessions for a specific product, but I am interested in sessions overall, i.e. not only related to a specific product.

 

LouiseEH
Shopify Partner
36 3 4

Update: I would prefer getting the exact same number of visits/sessions as from the Shopify Analytics report.
So even though I could calculate a number via other non-Shopify APIs og maybe with the Shopify web pixel API, I would prefer to use exactly the same data as what is accessible in the Shopify analytics reports

InnaB
Visitor
3 0 0

From what I understood from Shopify, you can't access session data through an API like you can through the interface.Ive been researching this subject for a while.

I am interested to know if you did manage to pull product data set sessions with ShopifyQL.

 

 

LouiseEH
Shopify Partner
36 3 4

Ah ok.
I did not try because it is not the data I am looking for.
But I guess something like below would do the trick:

query {
    shopifyqlQuery(query: "FROM products
    SHOW
    sum(gross_sales),
    sum(view_sessions)
    SINCE -7d") {
      __typename
      ... on TableResponse {
        tableData {
          unformattedData
          rowData
          columns {
            name
            dataType
            displayName
          }
        }
      }
      parseErrors {
        code
        message
        range {
          start {
            line
            character
          }
          end {
            line
            character
          }
        }
      }
    }
  }



made4Uo
Shopify Partner
3840 716 1177

Shopify uses Google analytics data. Might as well use the Google api if that is what your looking for 

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
LouiseEH
Shopify Partner
36 3 4

Thank you for your reply.
Ok that is interesting - where did you find information about that?

made4Uo
Shopify Partner
3840 716 1177

Information is the same as the Google analytics info

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
MicahNolte
Visitor
3 0 0

Hi,

 

I was looking to create a similar report in Power BI for the sessions over time.

I was hoping you could share what you have learn in you have create a report pulling the data from Google Analytics GA. To be more specific, if you use an api or sync the data from GA, which table did you find the data in, any other helpful information to jump start my task would be greatly appreciated.

 

M.

 

Mike