Hook up the Setup Component CTA to create/connect the property and measurement ID
See original GitHub issueFeature Description
Call the GA4 submitChanges function when the Setup Component CTA is clicked. This function will create the property and/or measurement ID and connect them.
For the “no existing GA4 property” variants, i.e when the CTA is Create property, ensure the GA4 propertyID is set to PROPERTY_CREATE prior to calling submitChanges.
Modify the BannerNotification component to allow the Button with Spinner to be used for the CTA button and show the spinner while the API calls made by submitChanges are in progress.
If an error occurs, display the error message in the banner.
- Design Doc: https://docs.google.com/document/d/1DeWo38lcV7lvLFfcmt-mQ0iaxzB4qfiPArs_yZzYkIM/edit#heading=h.2g0r7ejoqctz
- Figma: https://www.figma.com/file/vMaCWwr6lpk4PrJWb7jIpz/GA4-Banner-Input?node-id=1082%3A1549
Acceptance criteria
- When the Setup Component CTA is clicked:
- The property and measurement ID should be connected.
- For the “no existing GA4 property”, or when Set up a new property is selected from the dropdown, the property and measurement ID should first be created.
- When there is otherwise no measurement ID it should be created.
- The “use snippet” setting should be persisted (i.e. save the GA4 settings).
- Implementation note: all the above is taken care of by the existing GA4
submitChangesfunction.
- The spinner should be displayed in the button while the above activity is in progress.
- Any error that occurs should be displayed in the banner according to the design.
Implementation Brief
In assets/js/components/notifications/BannerNotification/index.js:
- Add a new prop,
ctaButton, that composes the CTA button. - Render the
ctaButtonas children if it’s available. It renders whatever the element is passed. In this case, it would be aButtonwith aSpinnerreusable component, which is being implemented in #5271. - Otherwise, render the
Buttonand theSpinnercomponents as it is today. https://github.com/google/site-kit-wp/blob/989112d08bcd9fa77067770af94799d4c6d7b754/assets/js/components/notifications/BannerNotification/index.js#L399-L411
The Setup Component is being Implemented in #5270 and #5275. Add the following logic to the Setup Component:
- Create a local state
errorto store the error object. - Create a
handleSubmitChangesasync callback using theuseCallbackhook with the following:- It should submit the changes by dispatching the
submitChanges()action of theMODULES_ANALYTICS_4store. - Get the
errorobject from thesubmitChangesaction result. - If there is an error, set the
errorobject to the error state.
- It should submit the changes by dispatching the
- If there is an
error, display the error message in the banner by rendering theErrorNoticecomponent and pass theerrorstate to theerrorprop. - Compose the “Button with Spinner” component, which is being implemented in #5271, and pass the
handleSubmitChangescallback to theonClickprop. - Pass the above to the
ctaButtonprop of theBannerNotificationcomponent. This will be rendered as the CTA button.
Test Coverage
- No new tests are to be added.
QA Brief
- Ensure that the
ga4ActivationBannerfeature flag is activated. - We need to check two different scenarios:
- No GA4 property available.
- GA4 properties exist, but not connected.
- To test
No GA4 property available:- Configure the Analytics module in Site Kit - use an account which does not have GA4 properties associated with it.
- Go to the Site Kit Dashboard.
- Click on
Set up nowin the displayed GA4 Activation Banner. - Under the
No existing Google Analytics 4 property foundheading, ifCreate Propertyis clicked, it should show a spinner and create a new GA4 property and measurement ID.
- To test
GA4 properties exist, but not connected:- Configure the Analytics module in Site Kit - use an account which does have GA4 properties associated with it.
- Go to the Site Kit Dashboard.
- Click on
Set up nowin the displayed GA4 Activation Banner. - Under the
Connect the Google Analytics 4 property that’s associated with your existing Universal Analytics propertyheading, selecting a property and clicking onConnectshould show a spinner and create a new GA4 property and measurement ID.
Changelog entry
- Enable the GA4 Activation Banner create/connect a property and measurement ID.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Scaffold GA4 Activation Banner "happy path" UI #5270 - GitHub
Prepare the basic local state and logic for stepping through these components, i.e. press the Reminder Component CTA to show the Setup ......
Read more >Set up Analytics for a website (Universal Analytics)
If you need a "UA- " Tracking ID, follow the instructions in this article. ... Your first step is to set up an...
Read more >Step-by-Step Guide: Setting Up New Analytics 4 Property
In this article, we will share some step-by-step instructions to set up and connect the Google Analytics 4 property, also known as GA4....
Read more >Google Analytics 4 Measurement ID - (What You Need To Know)
Setting up your new Google Analytics 4 property requires quite a few steps. From creating your property to enabling data collection, ...
Read more >NetSuite Applications Suite - Fixed Assets Management ...
Cumulative Translation Adjustment (CTA) Overview · CTA Balance Audit Report ... Enabling Multiple Units of Measure · Setting Up Units of Measure.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Approval ✅
@wpdarren Tested this again on my side, UI looks good to me now. There no longer is the progress bar together with the button spinner when creating a new GA4 property.
@felixarntz
The initial issue was that the screen flickers when the button is created, so this progress bar was introduced because of that. Since 5276 is in QA, should both of these tickets but looked at because the progress bar does appear on screen after clicking on the button in the different states.
c.c. @nfmohit @techanvil