Re: CSP and web analytics

On 6/8/11 7:41 AM, wrote:
> I don't know about omniture but for Analytics you can put the inlined
> JS inside a .js file.

Since those snippets are mostly boilerplate plus page-specific
chunks doing that a lot can create additional latency some sites
might want to avoid.  The local data could be put into DOM
attributes and then a common site-wide script (taking advantage of
caching) could move the data into the variables required by
analytics or the advertising solution.

In the future HTML dataset attributes could be used, you could even
use those now since if they're not supported natively several
javascript libraries (jQuery et al) have shims.

In Firefox you could even put the data in attributes on the
executing <script> tag itself and then the included 3rd party script
could use use to get
them. But realistically that would only be practical if
document.currentScript becomes a standard, adopted by other
browsers, and then supported by the various analytics/ad providers.

-Dan Veditz

Received on Friday, 10 June 2011 01:03:42 UTC