site-kit-wp: Incorrect redirects to WP Dashboard for sites with Internationalised Domain Names

Bug Description

On a site which uses IDNs (domains with multi-byte UTF-8 characters), redirects to the SiteKit dashboard are incorrectly directed to the WP Dashboard in various scenarios. This set of bugs were identified when implementing #4776.

Steps to reproduce

Scenario 1 - Setup SiteKit with Google Analytics

  1. Go to ‘https://türkish.com/wp-admin’. Login using credentials which can be obtained from @wpdarren, @jamesozzie or @jimmymadon.
  2. Setup SiteKit and tick the ‘Connect Google Analytics’ during SiteKit setup. After Step 4 - Connecting Google Analytics, instead of being redirected to the SiteKit dashboard, we are redirected to the WP Dashboard.
  3. Navigate to the SiteKit dashboard. Google Analytics is still not connected.

Scenario 2 - Setup SiteKit without Google Analytics

  1. Setup SiteKit but do not tick the ‘Connect Google Analytics’ during SiteKit setup. After Step 3, instead of being redirected to the SiteKit dashboard, we are redirected to the WP Dashboard.

Scenario 3 - Connect Analytics or AdSense

  1. Go to Settings and attempt to connect AdSense.
  2. After going through oAuth/setup, we are redirected back to WP Dashboard, and navigating back to settings shows that the set up is incomplete.

Additional Context

  • PHP Version: 7.4.15
  • OS: macOS 12.5.1
  • Browser: Chrome Version 105.0.5195.102
  • Plugin Version: 1.83.0
  • Device: MacBook Pro 13
  • WordPress Version: 6.0.2

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

Acceptance criteria

  • On sites which use multi-byte characters in their URLs / domain names (Internationalised Domain Names):
    • When setting up Site Kit, after the final step, the user should be redirected to the Site Kit dashboard as normal.
    • When setting up Site Kit with Analytics, the user should be redirected to the Site Kit dashboard as normal and Analytics should be connected successfully.
    • When connecting all modules in the plugin from the settings page, the module should be connected successfully and the user should be redirected to the Site Kit dashboard as normal.

Implementation Brief

Test Coverage

  • N/A

QA Brief

  • Use a site with IDNs (eg. a domain with multi-byte UTF-8 characters, like türkish.com/xn--trkish-3ya.com)
  • Set up a new install of Site Kit
  • When setup is complete, you should be redirected back to the Site Kit dashboard (eg. /wp-admin/admin.php?page=googlesitekit-dashboard) and not the WordPress dashboard (eg. /wp-admin/admin.php)
  • Do the same for AdSense and Analytics setup; you should also not be redirected to the main WordPress dashboard.

Changelog entry

  • Fix incorrect redirects for sites with internationalized domain names.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 24 (1 by maintainers)

Most upvoted comments

Hey @felixarntz just checking you are ok to pick this up? This is in the current sprint so ideally we would want this to be reviewed asap. Let me know if you do not think you have capacity for this, thanks so much!

@eugene-manuilov That should have been 1.83.0 when I created the issue. I’m 95% sure that I used the “Site Info” from this live test site when writing the ‘Additional Context’ section of this bug. (I myself could not replicate it on my local so the Additional Context would all be for the live site we found this issue on).