site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Allow changing Analytics view name when creating a new view

Open ernee opened this issue 7 years ago • 15 comments

Bug Description

Analytics new view creation duplicates default “All Web Site Data” view. No indication that the view was created, that the user needs to modify the view, or where to do it (on Analytics platform). Also referenced in #522 .

Steps to reproduce

  1. Go to the Analytics Module
  2. Click on the View dropdown and select Setup a new view
  3. Click on the button Confirm Changes
  4. After the page refreshes, the new view named “All Website Data” is selected, which is the same as the default view in Analytics.
  5. Navigating to the Analytics account, one gets a notification that there are “Redundant Views”

Screenshots

Duplicate All Website Data View in Site Kit

Duplicate All Website Data View in Site Kit

Duplicate All Website Data View in Google Analytics

Duplicate All Web Site Data View in Analytics

Redundant View Notification in Google Analytics

Redundant View Notification in GA

Additional Context

  • PHP Version: 7.1.30
  • OS: MacOS
  • Browser: Chrome
  • Plugin Version: 1.0.0-rc.1.1
  • Device: MacBook Air

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

If the user selects "Setup a new view":

  • display a field below the dropdown boxes where they can name the new view something different than the default ("All website data")
  • display a message "You can make changes to this view (e.g. exclude URL query parameters) in Google Analytics.", without a link.

Once the user creates the new view and saves it by clicking "configure analytics":

  • in the Settings section display the same text ("You can make changes to this view (e.g. exclude URL query parameters) in Google Analytics.") and a deep link to the relevant part of GA FE where they can make more changes to the specific view (link would be in the format https://analytics.google.com/analytics/web/?authuser={email}#/a[accountID]w[webPropertyID]p[profileID]/admin/view/settings)

Implementation Brief

  • When the "Set up a new view" option is chosen during module set up or settings edit, render an additional text input for the new view name (likely right below the dropdown), which defaults to "All Web Site Data"
    • The state for the input should be stored in the core/forms datastore under the analyticsSetup or analyticsSettings formID depending on the context and passed through to the create-profile request in the submitChanges action which handles the form submit for both set up and settings.
    • ~~Validate the view name to meet naming requirements~~
      There don't appear to be any restrictions on view names
    • Display a warning notice if the name matches an existing view of the selected property
      Look into using leadingIcon and helperText props on TextField conditionally for this (reference) Don't prevent the user from creating a new view with the same name if they want to
    • Add a descriptive message (text only) below the input:
      You can make changes to this view (e.g. exclude URL query parameters) in Google Analytics
    • Add a link to the view edit screen in Analytics to the SettingsView component
      • href https://analytics.google.com/analytics/web/?authuser={email}#/a[accountID]w[webPropertyID]p[profileID]/admin/view/settings
        where email is the value of select( 'core/user' ).getEmail()
      • text "You can make changes to this view (e.g. exclude URL query parameters) in Google Analytics"
  • Update POST:create-profile to take a new optional name parameter to override the default if provided

Changelog entry

  • Allow specifying Analytics view name when creating a new one, and display a deep link to modify view settings in Analytics module settings.

ernee avatar Oct 25 '19 18:10 ernee

@marrrmarrr Any idea how we can prevent (or at least guide away) the user from doing this?

It's expected in the current plugin behavior that this theoretically is possible, but as pointed out, it might not make sense if you just set up a duplicate identical profile. I'm not even sure we can determine that, but let's think about it.

felixarntz avatar Oct 28 '19 23:10 felixarntz

@aaemnnosttv The IB doesn't include the part about adding a message (with link if possible) to the relevant area in GA.

Extend the same behavior for creating a new property

I'm not sure I understand this part, there should not be an input field to name a new property - it only applies to a new profile.

felixarntz avatar Jan 16 '20 11:01 felixarntz

IB ✅

@aaemnnosttv Note that the link should only be displayed if actually valid, based on the currently selected values. For example, if a dropdown is set to "Select..." or "Setup new...", there should be no link because there's no ID to include.

felixarntz avatar Jan 17 '20 10:01 felixarntz

Moving this back as it now dependent on #1101

aaemnnosttv avatar Feb 05 '20 16:02 aaemnnosttv

Now that the analytics refactoring is complete, I think this IB can be revisited and confirmed/updated to work with the new analytics code. Note that it may need to be entirely replaced from the JS side as the JS code here is totally new.

After that it can be moved to IB review. Feel free to adjust the estimate and entire IB if needed. 😄

tofumatt avatar May 01 '20 14:05 tofumatt

IB updated!

aaemnnosttv avatar Jun 02 '20 10:06 aaemnnosttv

IB sounds good to me, IB ✅

tofumatt avatar Jun 02 '20 12:06 tofumatt

Tested

Installed latest develop SK, setup Analytics module. Navigating to setup and selecting 'New View'

Notice: image

Clicking confirm prompts: image

Ran through confirmation which landed me here: image

I added 2 'a's to my View name and selected confirm

Notice: image

image

Confirmed user can adjust and select the new view and prior default 'All Website Data'

One thing to note for consistency's sake.

Setting up a new account we use the term 'All website traffic' for the View

image

Adjusting in settings defaults to 'All Web Site Data'

image

Sending this back to @eugene-manuilov for an adjustment.

Suggesting we choose either 'All Web Site Data' or 'All website traffic' for consistency's sake.

cole10up avatar Jun 24 '20 06:06 cole10up

Good catch @cole10up -

In this case I think we should change the default used by the account provisioning screen as the default name for a new view is consistent with what is in place here: image

@marrrmarrr is it okay for us to change the default view name used on the new Analytics create account screen to "All Web Site Data" instead of "All website traffic"?

aaemnnosttv avatar Jun 24 '20 07:06 aaemnnosttv

@aaemnnosttv Just talked to @marrrmarrr, let's make the change.

felixarntz avatar Jun 24 '20 14:06 felixarntz

@felixarntz just to clarify, we're changing the default used in the account creation form, correct?

aaemnnosttv avatar Jun 24 '20 15:06 aaemnnosttv

@aaemnnosttv Yep 👍

felixarntz avatar Jun 24 '20 15:06 felixarntz

Retested

Confirmed the use of 'All Website Data' is now being displayed on the account provisioning screen

image

Ran a series of regression tests removing Analytics module, trying to setup module with the same view name (warning message displayed).

image

Passed QA ✅

cole10up avatar Jun 30 '20 06:06 cole10up

I just ran into an error with this locally due to undefined profiles. Sending this back to execution for a quick follow-up fix.

Error
Site Kit encountered an error
Cannot read property 'some' of undefined


    in ProfileNameTextField
    in div
    in div
    in SettingsForm
    in div
    in SettingsEdit
    in SettingsMain
    in InnerComponent (created by WithFilters(ModuleSettingsDetails))
    in WithFilters(ModuleSettingsDetails)
    in div
    in div
    in div
    in div
    in div
    in SettingsModule
    in div
    in Layout
    in div
    in SettingsModules
    in div
    in div
    in div
    in SettingsApp
    in RestoreSnapshots
    in ErrorHandler
    in Root

aaemnnosttv avatar Jun 30 '20 13:06 aaemnnosttv

Tested

Ran a series of regression tests with latest Develop focusing on new Analytics account creation, adjusting view names, proxy setup, uninstalling and reinstalling the module.

No issues on my end

Passed QA ✅

cole10up avatar Jul 02 '20 07:07 cole10up