Changed JavaScript Tracking Code generation to use "//" by Irrational86 · Pull Request #344 · matomo-org/matomo · GitHub
Skip to content
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

Changed JavaScript Tracking Code generation to use "//" #344

Merged
merged 5 commits into from
Sep 7, 2014
Merged

Changed JavaScript Tracking Code generation to use "//" #344

merged 5 commits into from
Sep 7, 2014

Conversation

Irrational86
Copy link

Changed JavaScript Tracking Code generation to use "//", instead of verifying whether the site is using "https", or not, and generating a corresponding URL.

"//" has been part of the RFC for well over 18 years. It has been confirmed to work in all major browsers (Firefox, Chrome, IE, Opera).

References:

…erifying whether the site is using "https", or not, and generating a corresponding URL.

"//" has been part of the RFC for well over 18 years. It has been confirmed to work in all major browsers (Firefox, Chrome, IE, Opera).

References:
- RFC 1808 Section 4: http://www.ietf.org/rfc/rfc1808.txt
- RFC 3986 Section 5.2: http://www.ietf.org/rfc/rfc3986.txt
- Stack Overflow QA 1: http://stackoverflow.com/q/4659345/238722
- Stack Overflow QA 2: http://stackoverflow.com/q/6785442/238722
@mattab
Copy link
Member

mattab commented Jul 15, 2014

Thanks for the pull request!

I see from Stackoverflow answers that It works on major browsers, but what about non major browsers?

For example, it "seems" important that Piwik JS tracker also tracks IE6 browsers... is it the case that this will work on IE6? or do you think we should not care whether Piwik tracker works on such older browsers?

Maybe you can use eg. http://browsershots.org/ to check which browser supports this, and then we can decide together publicly here whether it's acceptable to drop tracking for these older browsers?

@Irrational86
Copy link
Author

Hi Matt,

It actually works on IE6 - I obtained an IE6 VM from http://modern.ie/, and performed the test with the following file: http://www.orangecoding.com/double_slash.htm

The IE6 results can be found here:
IE6

Now, as for the rest of it - I need some help figuring out how to fix the issues that Travis is reporting. Would you be able to provide some pointers?

Thanks,
Jesse

@mattab
Copy link
Member

mattab commented Jul 24, 2014

Take for example this failing job: https://travis-ci.org/piwik/piwik/jobs/29180839

what's happening is this: there is an API that writes out the javascript tracker code. During the integration tests, all APIs are called, and the output as XML is stored and compared to expected output. When changing the JS tracking code such as this PR, the output of this API method changes. So it fails the test.

To fix this problem you can modify the file: tests/PHPUnit/Integration/expected/test_apiGetReportMetadata_year__SitesManager.getJavascriptTag.xml

The other test failure is a unit test. You can modify the expected value in the test file here: https://github.com/piwik/piwik/blob/master/tests/PHPUnit/Integration/Core/PiwikTest.php#L55-55

You can use travis to run the tests, or if you have some time to play, you can also setup PHPUnit on your local machine so you can run any Piwik test locally. See information in: https://github.com/piwik/piwik/blob/master/tests/README.md#how-to-run-piwik-tests

@Irrational86
Copy link
Author

Matt ( @mattab ),

Thanks for your help - I've got all of the tests passing now.

I also went ahead and did a browsershots with all of the lowest (oldest) versions available of all browsers on each OS available. The results are available here: http://browsershots.org/http://www.orangecoding.com/double_slash.htm

Successful:

  • Arora 0.11.0 / Ubuntu 9.10 (Karmic Koala)
  • Chrome 10.0.612.1 / Windows 2008 R2 (Server)
  • Epiphany 3.4.2 / Debian Testing (Lenny)
  • Firefox 3.0.19 / Debian Testing (Lenny)
  • Firefox 3.5.19 / Debian Testing (Lenny)
  • Firefox 4.0.1 / Windows 2008 R2 (Server)
  • Iceape 2.0.11 / Debian 6.0 (squeeze)
  • Iceape 2.7.12 / Debian 6.0 (squeeze)
  • Iceweasel 3.5.16 / Debian 6.0 (squeeze)
  • Kazehakase 0.5.8 / Debian Testing (Lenny)
  • Konqueror 4.11 / Debian 6.0 (squeeze)
  • Konqueror 4.13 / Debian 6.0 (squeeze)
  • Luakit 1.10.2 / Debian 6.0 (squeeze)
  • Midori 0.4 / Debian 6.0 (squeeze)
  • Opera 10.53 / Debian 6.0 (squeeze)
  • Opera 10.60 / Debian 6.0 (squeeze)
  • Opera 15.0.1147.72 / Windows 2008 R2 (Server)
  • Opera 21.0.1432.67 / Mac OS X 10.8 (Mountain Lion)
  • Rekonq 0.9.2 / Debian 6.0 (squeeze)
  • Rekonq 1.1 / Ubuntu 9.10 (Karmic Koala)
  • Safari 7.0.3 / Mac OS X 10.8 (Mountain Lion)
  • SeaMonkey 2.0.14 / Debian Testing (Lenny)
  • SeaMonkey 2.10.1 / Debian Testing (Lenny)
  • SeaMonkey 2.13.2 / Windows 2008 R2 (Server)

Failures:

  • Arora 0.11 / Debian 6.0 (squeeze)
  • Dillo 3.0.3 / Debian 6.0 (squeeze)
  • Links 2.7 / Debian 6.0 (squeeze)
  • Links 2.8 / Debian 6.0 (squeeze)
  • Lynx 2.8.8 / Debian 6.0 (squeeze)

I would vouch for the ones that failed to be accepted as unsupported. I have not confirmed whether the issue is browsershots integration, or the double-slash method.

Failed browsers development activity:

Hope this helps make a decision whether to accept the double-slash change or not.

Regards,
Jesse

@mattab mattab added this to the Short term milestone Aug 3, 2014
@mattab mattab modified the milestones: Short term, Piwik 2.6.0 Aug 26, 2014
@mattab
Copy link
Member

mattab commented Aug 26, 2014

I added this to 2.6.0 milestone, so I'm planning to merge the PR. If anyone has any feedback now is a good time to send it :)

@Irrational86
Copy link
Author

@mattab The only thing I would like noted related to this PR is that this PR modifies the JavaScript code specifically. Stefan Giehl's comment mentions that this PR includes the fallback image, but it actually doesn't. I didn't think of it at the time =.

I will go back and make the same protocol-agnostic changes for the fallback image. Would you rather wait for those in this commit, or leave them to be a separate PR?

I would personally suggest a separate PR, so that this one can get into production sooner, rather than later.

@mattab
Copy link
Member

mattab commented Aug 26, 2014

Thanks for heads up.

I will go back and make the same protocol-agnostic changes for the fallback image. Would you rather wait for those in this commit, or leave them to be a separate PR?

I won't merge until Sept 5th at earliest, so if you do the image fallback change before, it's best to put it in the same PR, otherwise in a different one is fine. cheers

@tassoman
Copy link
Contributor

tassoman commented Sep 1, 2014

As far I can remember, Lynx and Links2 are shell console browser that doesn't parse javascript.
Try Adding <noscript> no js </noscript> after the double slash <script> test

@Irrational86
Copy link
Author

@tassoman You were absolutely correct!

The failed browsers above are due to JavaScript not being available. I have submitted the page to browsershots.org once again, this time including the failed browsers only, and all passed with the correct message!

This means that all browsers are working properly with the change.

@mattab mattab self-assigned this Sep 2, 2014
@mattab
Copy link
Member

mattab commented Sep 2, 2014

This means that all browsers are working properly with the change.

Ok that's a really good news, so this change is 100% awesome.

@Irrational86
Copy link
Author

@mattab I believe I have successfully changed all places where the fallback image is generated. All tests are passing. I think we're good to go on this enhancement.

mattab pushed a commit that referenced this pull request Sep 7, 2014
Changed JavaScript Tracking Code generation to use "//"
@mattab mattab merged commit 0aecd47 into matomo-org:master Sep 7, 2014
@mattab
Copy link
Member

mattab commented Sep 7, 2014

Thanks @Irrational86 for the great Pull request. I've merged it as it's nice to move piece by piece in the future of the web. Cheers!

mattab added a commit that referenced this pull request Sep 9, 2014
mattab added a commit that referenced this pull request Sep 23, 2014
…h should be used in the generated tracking code refs #344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants