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

Asynchronous JavaScript tracking code #1842

Closed
robocoder opened this issue Nov 27, 2010 · 7 comments
Closed

Asynchronous JavaScript tracking code #1842

robocoder opened this issue Nov 27, 2010 · 7 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@robocoder
Copy link
Contributor

Provide fast asynchronous javascript tag in Piwik 1.1

See the new documentation in http://piwik.org/docs/javascript-tracking/#toc-asynchronous-tracking

@robocoder
Copy link
Contributor Author

(In [3374]) fixes #1842, refs #739 - implement asynchronous tracking (thanks Xaver); see updated documentation, http://piwik.org/doc/javascript-tracking/

@robocoder
Copy link
Contributor Author

(In [3375]) refs #1842, refs #739 - implement push functions

@mattab
Copy link
Member

mattab commented Nov 28, 2010

Excellent!!!
Reopening, for few questions and reminders:

  • Ga tracking tag sets a script.type = 'text/javascript'; on the DOM node. we shoudl maybe do the same?
  • Why does the snippet on the doc doesn't contain the "https:" == document.location.protocol test? Is it relying on the browser to understand that //PIWIK_URL will load with the right protocol?
  • why is 'script' passed as a parameter to the anonymous function rather than harcoded in the 2 places it is used? It saves character space, but it isn't really a parameter as such... (same with the 'document' parameter?).
  • UI for 'show javascript tracking tag' should probably explain how to use the asynchronous version.
  • Should we make the asynchronous version the default one in the UI (during install and in the SitesManager)?
  • Documentation could clarify at the start that 2 distinct Tracking techniques exist. Not sure how we should organize it.

@robocoder
Copy link
Contributor Author

This was largely Xaver's code. I've updated the docs and opened a new ticket for the outstanding questions/ideas.

Replying to matt:

  • Ga tracking tag sets a script.type = 'text/javascript'; on the DOM node. we shoudl maybe do the same?

Yes, we should. This is required per HTML4 spec, but was optional in practice. Thus, in HTML5 'text/javascript' is the default if type is unspecified.

  • Why does the snippet on the doc doesn't contain the "https:" == document.location.protocol test? Is it relying on the browser to understand that //PIWIK_URL will load with the right protocol?

I've changed it to use the old code so that it's clearer. But it is a clever optimization. The URI spec contains rules to resolves URI references. In this case, it should use the document's base URI to determine the scheme, if not specified.

  • why is 'script' passed as a parameter to the anonymous function rather than harcoded in the 2 places it is used? It saves character space, but it isn't really a parameter as such... (same with the 'document' parameter?).

To save bytes. I've removed the parameters.

  • UI for 'show javascript tracking tag' should probably explain how to use the asynchronous version.
  • Should we make the asynchronous version the default one in the UI (during install and in the SitesManager)?
  • Documentation could clarify at the start that 2 distinct Tracking techniques exist. Not sure how we should organize it.

Opening a new ticket for these.

@robocoder
Copy link
Contributor Author

Replying to vipsoft:

In this case, it should use the document's base URI to determine the scheme, if not specified.

"it" == a conforming user agent.

@mattab
Copy link
Member

mattab commented Nov 28, 2010

Thanks for the updates, looks good!

@mattab
Copy link
Member

mattab commented Dec 23, 2010

see #1845

@robocoder robocoder added this to the Piwik 1.1 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants