Development discussions around Shopify APIs
I would like to use the Analytics API with the Shopify App Bridge instead of the Embedded App SDK.
Setup in Embedded App SDK code would like this based on the documentation:
ShopifyApp.ready(function(){
var shopifyQL = "SHOW count() FROM visits SINCE -2w UNTIL today";
var renderData = function(response) {
// do amazing things here
};
var handleError = function(response) {
// handle missing API errors here (missing scopes, back shopifyql, etc...)
};
ShopifyApp.Analytics.fetch({
query: shopifyQL,
success: renderData,
error: handleError
});
});
From the old Embedded App SDK documentation, it mentions that ShopifyApp.ready(fn)
has " no equivalent method in Shopify App Bridge, as this functionality is no longer necessary."
I tried to migrate the code to use the Shopify App Bridge, however it did not work:
import createApp from '@shopify/app-bridge';
const app = createApp({
apiKey: '<api key>',
shopOrigin: '<origin>',
});
// This works
app.getState().then((state) => {
console.info('App State: %o', state);
});
// This doesn't work
app.Analytics.fetch({
query: 'SHOW count() FROM visits SINCE -2w UNTIL today',
success: () => { console.info('success'); },
error: () => { console.info('error'); },
});
Is it possible to use the Analytics API with the App Bridge? If not, what would be wrong with my syntax? Any documentation on this would be a big help 😄
Thank you!
Regards,
Nicole
Hi Nicole,
I've noticed you seem to be having issues with Analytics API using either newer AppBridge or its predecessor EASDK.
Regarding AppBridge, I am afraid you're out of luck for now according to this issue on Github.
As for EASDK issues from your other post, I wouldn't know, never played around with EASDK or Analytics API (for the time being).
Best wishes!
Just chiming in to say that at this time you cannot use the analytics API at the same time as App Bridge. We're currently working on finding a path forward with handling the analytics API working with App Bridge.
Alex | 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
@Alex can you please provide an update on this?
It's been over a year. Shopify is saying that the embedded sdk is deprecated yet we can't find a way to query ShopifyQL in bridge.
What's the status/plan?
Any updates on this?
How are we expected to upgrade to Bridge otherwise?
Hi @ClementBR ,
To give you a straight update here, as of right now the Analytics API is still not supported directly by the App Bridge.
However this feature is supported through the backwards compatibility layer. So if you are looking to use this feature in your app, you can use the EASDK to write your code and then enable the App Bridge backward compatibility layer to kick in. That way you can still utilize the Analytics API and ShopiQL from your app. Read here for more details on the backward compatibility layer: https://shopify.dev/tools/app-bridge/migrating
(Note I believe some users using the backward compatibility layer are seeing and error about "StaffMember ID is missing". We are looking into this currently, and there is another ongoing thread providing support for this: https://community.shopify.com/c/Shopify-APIs-SDKs/What-s-meaning-quot-StaffMember-ID-is-missing-quot...)
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
So you are saying that we can use both Bridge and EASDK at the same time?
Are there no plans of implementing ShopifyQL/Analytics in Bridge?
@hassain can you please provide more details or an example?
The docs are extremely light and there is nothing about using ShopifyQL with Bridge.
Do we have to include BOTH easdk AND bridge to make this work?
@hassain we are working through our migration to Bridge but we can't get this to work.
We initialized both bridge and EASDK but when we call the fetch method, neither the success callback nor the error callback is called.
ShopifyApp.Analytics.fetch({
query: strSql,
success: onSuccess,
error: onError
});
Can you help us out here?
Not sure how we expected to migrate to Bridge.
@hassain my bad, it seems to be working now... not sure what happened.
Still, we're hoping that Bridge will incorporate the Analytics API natively so that we don't have to use both libraries at the same time.
@hassain Ok, I spoke too fast...
If we include both libraries, then the Bridge library stops working silently.
Scenario 1:
We include only bridge.
Using History and Loading actions work.
But we can't use analytics.
Scenario 2:
We include both bridge and EASDK
We can use analytics again.
But History and Loading actions silently fail. They do nothing.
So much confusion and wasted time....
Can you please advise how to proceed?
We hear that the new upcoming cookie-less oauth will only be available for Bridge, but we can't use it if we need Analytics....
@hassain could you please provide an update?
When will analytics API be added to Bridge.
Currently it doesn't seem possible to use both Bridge and EASDK at the same time.
Because Bridge doesn't have Analytics, we can't migrate and benefit from new features such as cookieless auth.
Hello?
So how are we supposed to upgrade to Bridge if Analytics is not supported?
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023