need php code for shopify analytics api

Highlighted
New Member
2 0 0

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

i refer above link for setup bt when i run my php page it redirect me my shopify account and showing below error.please suggest me what i'm doing wrong and please reply asap.

The page you’re looking for couldn’t be found

Check the web address and try again, or try navigating to the page from Shopify Home.

 
0 Likes
Highlighted
Shopify Staff
Shopify Staff
915 56 113

Hi there @honey123!

 

Don here from Shopify.

 

I just wanted to let you know that I had moved your query here to our API forums in order for you to get the best response available.

 

We're not able to provide API assistance ourselves from Support, but these forums are monitored and responded to by our Developer team in addition to Shopify Partners and Experts so this is where you would need to post for this kind of query.

 

Hopefully, our community will be able to chip in here with their experience and help out.

 

All the best!

 

 

Regards,

Don

Don | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
Highlighted
New Member
2 0 0
<head>
  <script type="text/javascript">
    ShopifyApp.init({
      apiKey: my_api_key',
      shopOrigin: origin'

    });
    
    ShopifyApp.ready(function() {
    var shopifyQL = 'SHOW total_visitors, total_sessions OVER day(timestamp) AS day FROM visits SINCE -7d UNTIL today ORDER BY day ASC';
    var renderData = function(response) {
        console.log(response);
        alert("success");
      // do amazing things here
    };
    var handleError = function(response) {
        alert("error");
      // handle missing API errors here (missing scopes, back shopifyql, etc...)
    };
    ShopifyApp.Analytics.fetch({
      query: shopifyQL,
      success: renderData,
      error: handleError
    });
  });
  </script>
  
</head>

when i run this code in my php page it will redirect to my shopify dashboard .instead of json response.
0 Likes