Update product analytics onboarding state management
What does this MR do and why?
This MR updates the Product Analytics onboarding to use the new productAnalyticsState
resource that was added in #391973 (closed).
This MR makes the following changes:
- Add a new state component that queries
productAnalyticsState
. - Update the onboarding components to use the new state component.
- Move GraphQL queries out of the mutations dir.
- Move instance creation mutation to the empty state component so that it's in the component that calls it.
- Remove unused hasAnalyticsData method.
Related issue [Frontend] Update the analytics app to retrieve... (#391974 - closed).
This feature is hidden behind a default off feature flag.
Screenshots or screen recordings
There should be no visual changes.
Recording
Kapture_2023-03-28_at_17.49.01
Screenshots
Click to expand
Not set up state
Before | After |
---|---|
![]() |
![]() |
Waiting for events state
Before | After |
---|---|
![]() |
![]() |
Complete state
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
To test the product analytics dashboard items are shown, you will need to follow the instructions at https://gitlab.com/gitlab-org/gitlab/-/snippets/2474959 to enable Product Analytics on your GDK.
- Create a new project or view one that does not have product analytics setup yet.
- Visit the product analytics view at
[GDK_HOST]/gitlab-org/[PROJECT]/-/product_analytics/dashboards/
- Note this is not the new
/analytics
view!
- Note this is not the new
- Click on
Set up product analytics
- Wait for the instrumentation screen to appear and copy the
SDK App ID
. - To create events, add the userscript below (eg using tapermonkey) for your GDK and change
YOUR_APP_ID_KEY
to yourSDK App ID
. - Go back the instrumentation screen tab and click on something. You should then be redirected to the dashboard lists view.
Click to view userscript
(function() {
var jsSDK = document.createElement('script');
jsSDK.setAttribute('src','https://unpkg.com/@gitlab/application-sdk-js/dist/gl-sdk.min.js');
jsSDK.onload = function() {
window.glClient = window.glSDK.glClientSDK({
applicationId: 'YOUR_APP_ID_KEY',
host: 'http://localhost:8000/configurator'
});
window.glClient.page();
}
document.head.appendChild(jsSDK);
})();
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #391974 (closed)