Monthly Archives: October 2009

Thinking About User Tracking on WriteToReply

Looking over the range of commentable docs that we’ve hosted on WriteToReply, I started to wonder whether or not we’re getting different sorts of visitors to the documents depending on the document type. So for example, might we expect to get visitors from UK HEIs looking at the JISC and REF documents, or folk from local councils and government departments looking at the Government URI schemes or Open Source for Government guidelines?

One way of tracking this information is to look at the IP address of each visitor, and then try to reconcile it back to a different domain. In Google Analytics, the Network Location field contains a lookup of the owner of a referring IP address, which can be used as an informal “affinity string” to provide anecdotal evidence about where a website’s visitors are actually located.

The easiest way I’ve found of reporting the Network Location is to use an “Advanced Segment” to provide a view over a Google Analytics report limited to traffic coming from a particular sort of network location. So for example, when looking at the higher education related reports, it makes sense to try and get a feel for how much traffic is coming from university networks. Here’s the rather simple Advanced Segment I use:

Traffic from universities - GA advanced segment

If we select this segment alongside the “All visits” segment:

Advanced segments in GA

we can get a feel for how much of the traffic into the REF commentable document was coming from HE campuses:

Visits to REF consultation from 'university' networks

If I deselect “All visitors”, and just focus on traffic within my advanced segment, we can look at which “university” related domains were sending traffic to the site:

Uuniversity visits to REF

Another trivial Advanced Segment I use looks for traffic from council related websites:

Council advanced segment

So how are the URIsets doing for council network visitors?

Council visits to govurisets


Also note that the Network Location parameter is not necessarily that reliable. Much of the time, the location corresponds to one ISP or another. But as an indicator, it may be useful…

Paragraph Embedding from JISCPress

One of the things I was keen to explore within the context of the JISCPress project was the potential for using WordPress as a platform for publishing paragraph level fragments that could be embedded in third party web pages.

As Joss announced on the JISCPress blog, We’ve got paragraph data output switches! that expose paragraph level content through a unique URI in a variety of formats (xml, txt, html, rss and json), as well as object embed codes for each paragraph, though I’m not sure if this is going to be maintained…? e..g at the moment, I think we’re trialling literal text blockquote embeds:

Blockquote embed

(If the object embed does disappear, similar functionality could be achieved using the JSON feed and a Javascript function, though I guess we need JSON-P (i.e. support for something like &callback=foo to make that really easy.)

See also: A Quick Update for a review of the latest feature releases within the theme we’re using.

To demonstrate one possible use case for object embedding, see the post Engaging With the Issues Raised By The Google Book Settlement which includes three embedded paragraphs from the JISC’s current consultation around the Google books settlement.

Embedding content from write to reply

Here’s the actual HTML:

Embedding content from WriteToReply

Note that currently there is an issue with sizing the embed container (can any CSS gurus out there give us a fix?

Object sizing issue with WTR embeds

Ideally we need to identify the container height and then size it automatically so there are no scrollbars? I’m guessing .scrollHeight might have a role to play in autodetecting this?)

One thing you might notice is that the URIs for the embedded consultation questions follow a similar pattern – only the paragraph number identifier changes:

What this means is that we should be able to pull in a random paragraph by constructing a URI with a randomly generated paragraph number. So for example:

var n=2+Math.floor(Math.random()*5);
var o=document.createElement(‘object’);
o.setAttribute(‘style’,’width: 100%; height:70px;’);
var p=’’+n;
p=p.replace(/#038;/,”); //get round WordPress escaping everything…

If you reload the page, you have an 80% chance of seeing a different question…

Here’s the Javascript snippet:

var n=2+Math.floor(Math.random()*5);
var o=document.createElement('object');
o.setAttribute('style','width: 100%; height:70px;');
var p=''+n;
p=p.replace(/#038;/,''); //get round WordPress escaping everything...

//There’s a div with an appropriate id attribute (‘wtr_embed’) also added to the page…
//Note that the div needs to be placed before any inline Javascript in the page;-)

I’m not sure yet if we can track the use of embeds (certainly server logs should be able to track calls, but these probably can’t be captured using Google Analytics?), but it’s still early days…