diff --git a/README.md b/README.md index 0d77ebe..aac67f7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ data-analytics.js ================= -data-analytics.js aims to simplify analytics tagging within a page, by +data-analytics.js aims to simplify analytics tagging within a page by providing a means of specifying analytics data in purely declarative `data-analytics` attributes, instead of requiring click handlers to be written. @@ -33,7 +33,7 @@ A field can also be repeated in the DOM heirarchy, with the deeper element overr
  • Dog
  • ...
  • -For event tracking, when a link is clicked data-analytics.js submits the event data to be recorded if +For event tracking, when a link is clicked, data-analytics.js submits the event data to be recorded if: at least `category`, `action`, and `label` are defined (or inherited) for that link. @@ -44,7 +44,7 @@ For sharing analytics over muliple distinct domain names, give the body tag on both sites a data-analytics attribute with a `domains` field. This field is a space-separated list of those shared domains. To also include subdomains, prefix the domain name with a dot. -Subdomains are automatically always included if using Universal +Subdomains are automatically included if using Universal Analytics (analytics.js). diff --git a/data-analytics.js b/data-analytics.js index 3814d25..5cc3bcb 100644 --- a/data-analytics.js +++ b/data-analytics.js @@ -1,9 +1,9 @@ /** data-analytics.js * @author David Nordlund * © Province of Nova Scotia * Simplify event recording and cross domain visits for Google Analytics */ -(function(data_analytics) { +(function (data_analytics) { function clicked(e) { - var tag = e.target||e.srcElement; (tag.nodeType==1)||(tag = tag.parentNode); + var tag = e.target || e.srcElement; (tag.nodeType == 1) || (tag = tag.parentNode); var dav = data_analytics.values(tag); var a, actiontags = {A:1, AREA:1, BUTTON:1}, i, imp; for (a = tag; a && !(a.tagName in actiontags); a = a.parentNode); //a = ancestor action tag