question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A site url with an internationalized domain name (IDN) will not show data for the Analytics portion of GSK

See original GitHub issue

Bug Description

A site url with an internationalized domain name (IDN) will not show data for the Analytics portion of GSK.

Steps to reproduce

If the web site url is an IDN such as this sample: (click here to convert IDN to ASCII)

unicodenáme.xxx (unicode)

xn–unicodenme-z4a.xxx (ASCII)

  1. Go to ‘G Site Kit’ on the WordPress Dashboard’
  2. Click on ‘Dashboard’ or ‘Analytics’
  3. See message:

‘Analytics Gathering Data Analytics data is not yet available, please check back’

Additional Context

This issue was presented to WordPress Support and I followed all instruction there with no avail.

https://wordpress.org/support/topic/analytics-gathering-data-analytics-data-is-not-yet-available-please-check-back-9/

By digging into the GSK plugin version 1.34.1 myself, I found the following temporary solution:

Sending site url in unicode shows the Analytics data. So, instead of sending xn–unicodenme-z4a.xxx, send unicodenáme.xxx

I accomplish that as a temporary solution by hardcoding

…\google-site-kit\includes\Modules\Analytics.php around line 613

/* Added by Horacio to make the IDN work on this plugin */
$request['dimensionFilterClauses'][0]->filters[0]->expressions[0] = 'unicodenáme.xxx';
$request['dimensionFilterClauses'][0]->filters[0]->expressions[1] = 'www.unicodenáme.xxx';

And now Analytics shows fine everywhere in my IDN web site.

Note: obviously my website’s url is not as shown here, this is just a sample of what an IDN url is.

Of course, a permanente solution will depend on Google developers to make Site Kit by Google compatible with IDN web sites. Perhaps by using the viewID instead of the url.

Please understand that this issue have nothing to do with environment (device, OS, platform, PHP and WordPress version, other plugins, etc.).

It is simply that the GSK plugin is sending information to the Analytics Reporting API that it does not understand and it reports no data.


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

Acceptance criteria

  • The Module::permute_site_url method should be enhanced so that it also considers permutations for a Unicode or Punycode URL if needed.
    • If the site URL is an international URL with unicode characters, also create the punycode version.
    • If the site URL is an international URL in punycode format, also create the unicode version.
    • These permutations also need to go through the other permutation of considering HTTP vs HTTPS and www. vs non-www., so any site that uses an international URL now should end up with 8 permutations - non-international URLs should be kept as now (i.e. 4 permutations).
  • In other words, the above change should result in Analytics and AdSense report requests correctly filtering by domain even for international site URLs (no matter whether stored in WordPress as unicode or punycode).

Implementation Brief

Update the Module::permute_site_url method:

  • Add a hosts array
  • add the wp_parse_url parsed hostname to the hosts array
  • if the hostname is prepended by the IDN xn-- string
    • convert the hostname to unicode idn_to_utf8( $hostname, 0, INTL_IDNA_VARIANT_UTS46 )
  • otherwise convert the hostname to IDN ASCII idn_to_ascii( $hostname, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 )
  • if the hosts array does not already contain the converted hostname, add it to the hosts array
  • for each of the items in the hosts array add the http, https and www permutations.

Test Coverage

  • n/a

Visual Regression Changes

  • n/a

QA Brief

  • Create a release zip and upload it to a site which has an IDN domain name
  • Check that Analytics data is being displayed in GSK @jamesozzie has a suitable site with an IDN.

Changelog entry

  • Fix bug where the filter behavior used for Analytics and AdSense report data was not working for sites with a unicode or punycode domain.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:30 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
HFigarellacommented, Aug 2, 2021

GSK Version 1.38.0 works fine with an internationalized domain name (IDN)!

Site: (something like) unicodenáme.xxx (unicode) Self hosted at home and on production with thousands of visitor a day. OS Windows Server 2019 - Microsoft-IIS/10.0 WordPress version 5.9-alpha-51524 MySQL version 8.0.26 for Windows PHP version 8.0.9 64bit Jetpack version 10.1-alpha:1627440389 Plus more than 70 other plugins, some of them mine not published anywhere else

Muchas gracias a todos

1reaction
felixarntzcommented, Jul 8, 2021

@aaemnnosttv Great find - using that sgtm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Analytics Gathering Data Analytics data is not yet available ...
Does the fact that site 2 is an internationalized domain name (IDN) matter for the Analytics portion of GSK to show the data?...
Read more >
HTTP/HTTPS enabler options and values - IBM
The HTTP/HTTPS enabler portion of the z/OS web enablement toolkit allows many customizable options to determine how the toolkit should process a request....
Read more >
Coronavirus (COVID-19) Vaccinations - Our World in Data
Our international COVID-19 vaccination dataset is updated each morning ... All charts on this page will then show data for the countries that...
Read more >
Tracing the origin of paracetamol tablets by near-infrared, mid ...
Sample No. Name, Pharmaceutical Company, Origin, Quantity. 1*, Panadol, GlaxoSmithKline plc. AUS, 12. 4*, Paracetamol ...
Read more >
A new wave of innovation for real-world evidence - IQVIA
analytics, and the rise of new avenues to bring in data – are the ones that will gain advantage from RWE innovation. It...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found