-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve default Analytics property selection when selecting an Analytics account #3291
Comments
I don't see the intended return value of this action in the IB. In the GA4 implementation of a similar action we return the property via
From the IB it looks like it should be returning a property if a matching one is found, as below I see:
So sounds like the Otherwise this looks good, but can you clarify how the action should return when it finds a match? I think what I expect is what you implied, but it was a bit unclear so I think could use clarification. |
@tofumatt Good catch - thank you 🙏
From reading the ACs, I guess my assumption was that the action is passed an array of properties and it would be like an array filter: return the matching property if there is one or some falsey value if there isn't (I see the GA4 one returns Does that sound good? I've updated the IB with this for now, but let me know if it needs changing or I have misunderstood. |
That makes perfect sense and is what I expect. Returning IB ✅ |
QA Update: Confirm with Engineer
|
@wpdarren you need to create the regular UA property, not GA4 as you created above. |
QA Update: Pass ✅Verified:
@eugene-manuilov thank you, I'd not realised that by default it creates it as GA4, and that you have to select UA property. |
Approval ❌@eugene-manuilov @aaemnnosttv This is not working as expected in my testing:
Not sure this is an edge-case, but there is definitely something off here. |
Hm... Unfortunately, I can't reproduce it on my end. It selects the property correctly for me...
Ok, makes sense. I have created a follow-up PR to fix this: #3481. @felixarntz do you mind reviewing it? |
@eugene-manuilov Left some feedback, the PR mostly looks good for the fallback issue. I left some follow-up questions to clarify my scenario further - please try to recreate exactly that if you haven't yet. |
@felixarntz I had to create a new branch and create a new PR #3484 because I couldn't rebase that branch :(
Yes, it seems to work on my end. Even don't know why it doesn't work for you 🤔 |
@eugene-manuilov Merged the PR. I just figured out why the property switching didn't work for me: It was simply because the one property I was using didn't actually have the So this is all good to go! 🚢 |
This enhancement purely relates to the existing Analytics module and the
modules/analytics
store, but it is still part of the GA4 epic since it ensures certain prerequisites to bring the same functionality to GA4 are in place.Currently, when selecting an Analytics account (in the module setup or settings), the first property will be initially selected. This experience should be improved to be as follows:
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
getSiteURLPermutations()
should be added to thecore/site
store. It should create return all 4 "permutations" of the current site URL, including/excludingwww.
and withhttp://
orhttps://
. No trailing slash should be included at the end of each permutation.matchPropertyByURL( properties, url )
should be implemented in themodules/analytics
store, with a purpose similar to the action of the same name in themodules/analytics-4
store (see Allow matching a GA4 property by data in its web data stream #3168).websiteUrl
which matches the givenurl
(ifurl
is a string) or matches any of the given values inurl
(ifurl
is an array of strings).selectAccount
action in themodules/analytics
store should be enhanced to try to find a matching property rather than just selecting the first property:modules/analytics
selectorgetProperties
and, once properties have been fetched, rely on the newmatchPropertyByURL
action in the same store (see above) passing thegetSiteURLPermutations
array of URLs to attempt to find a matching UA property for the current site URL. If one is found, theselectProperty
action should be called with it so that it is set.getProperties
resolver that potentially selects the first property if none is selected yet should be removed, since it is no longer relevant - this should have always happened from withinselectAccount
as it is the appropriate action to trigger any automated sub-selections.Implementation Brief
getSiteURLPermutations
, which should:getReferenceSiteURL
selectorwww.
http://
orhttps://
matchPropertyByURL
in the Analytics store, which acceptsproperties
andurl
argumentsproperties
should be an array of property objectsurl
should either be a URL string or an array of URL stringswebsiteUrl
which matchesurl
(ifurl
is a string)url
(ifurl
is an array of strings)null
.selectAccount
selector in the Analytics datastore, after thegetProperties
selector is called:getSiteURLPermutations
selector to get an array of URL permutationsmatchPropertyByURL
action, passing the array of URLsselectProperty
action with it so that it is set.selectAccount
action, either the matched property should be selected or no property should be selected at all.getProperties
resolver, remove the logic that selects the first property if none is already selected.Test Coverage
getSiteURLPermutations
selector and the behaviour inselectAccount
. Existing tests forgetProperties
may need adjusting.Visual Regression Changes
QA Brief
Extra criteria for follow-up QA
Changelog entry
The text was updated successfully, but these errors were encountered: