@robocoder opened this Issue on November 27th 2010 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 commented on November 27th 2010 Contributor

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

@robocoder commented on November 27th 2010 Contributor

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

@mattab commented on November 28th 2010 Member

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 commented on November 28th 2010 Contributor

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 commented on November 28th 2010 Contributor

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 commented on November 28th 2010 Member

Thanks for the updates, looks good!

@mattab commented on December 23rd 2010 Member

see #1845

This Issue was closed on January 8th 2011
Powered by GitHub Issue Mirror