diff --git a/_config.yml b/_config.yml index e92b2c54f..104d3d7a5 100644 --- a/_config.yml +++ b/_config.yml @@ -64,3 +64,7 @@ dartlang_target: dartlang demo_component_src_branch: gh-pages demo_dart_src_path: build/web/demos/ + +# Google Analytics Helpers +repo_pageview_page: /over_react/github +dartdocs_pageview_page: /over_react/api-docs diff --git a/demos.html b/demos.html index 4da62daad..03417a5f2 100644 --- a/demos.html +++ b/demos.html @@ -32,7 +32,8 @@

+ aria-label="{{ demo.component_class }} Demo Component Source Code" + onclick="handleSourceCodeView('{{ demo.component_class }}');"> Source Code diff --git a/docs/_data/demos.yml b/docs/_data/demos.yml index 526e819fb..f3e051acb 100644 --- a/docs/_data/demos.yml +++ b/docs/_data/demos.yml @@ -2,7 +2,7 @@ slug: button component_class: Button title: Button Component Demo - lead: 'A component that renders a Bootstrap Button element using OverReact’s statically-typed React prop API.' + lead: 'A component that renders a Bootstrap Button element using OverReact’s statically-typed React prop API.' img: false - id: list_group @@ -10,19 +10,19 @@ component_class: ListGroup child_component_class: ListGroupItem title: ListGroup Component Demo - lead: 'A component that renders a Bootstrap List Group element using OverReact’s statically-typed React prop API.' + lead: 'A component that renders a Bootstrap List Group element using OverReact’s statically-typed React prop API.' img: false - id: progress slug: progress component_class: Progress title: Progress Component Demo - lead: 'A component that renders a Bootstrap Progress element using OverReact’s statically-typed React prop API.' + lead: 'A component that renders a Bootstrap Progress element using OverReact’s statically-typed React prop API.' img: false - id: tag slug: tag component_class: Tag title: Tag Component Demo - lead: 'A component that renders a Bootstrap Tag element using OverReact’s statically-typed React prop API.' + lead: 'A component that renders a Bootstrap Tag element using OverReact’s statically-typed React prop API.' img: false diff --git a/docs/_includes/demo-code-example.html b/docs/_includes/demo-code-example.html index 98e5c144a..ccd25652d 100644 --- a/docs/_includes/demo-code-example.html +++ b/docs/_includes/demo-code-example.html @@ -21,18 +21,18 @@ diff --git a/docs/_layouts/home.html b/docs/_layouts/home.html index d9ae38b4c..8d5aba015 100644 --- a/docs/_layouts/home.html +++ b/docs/_layouts/home.html @@ -12,7 +12,9 @@

Demos - + API Docs @@ -31,9 +33,11 @@

The best of both worlds.

The {{ site.pkg_name }} platform delivers the declarative awesomeness of - React + React and all the creature comforts of - Dart + Dart in a single package!

@@ -54,7 +58,12 @@

The best of both worlds.

Make components;
not boilerplate.

The {{ site.pkg_name }} platform makes use of a powerful Pub transformer - to wire up a factory and React component class, + to wire up a factory and + + React component class + , along with props and optional state classes, so you can focus on building UI that your consumers — and customers — will love.

diff --git a/docs/assets/js/docs.js b/docs/assets/js/docs.js index 9dc8f24f3..fdc4e819b 100644 --- a/docs/assets/js/docs.js +++ b/docs/assets/js/docs.js @@ -1,3 +1,57 @@ +var gaSourceCodeViewPath = '/over_react/demos/source/'; + +function gaLinkHandler(action, label, isAffiliated, page) { + // For one reason or another, analytics was not loaded onto the page + if (!ga) return; + + isAffiliated = isAffiliated || false; + + var evCategory = 'External Link'; + + if (isAffiliated) { + evCategory += ': Affiliated'; + } else { + evCategory += ': 3rd Party'; + } + + // Track as an event + ga('send', 'event', evCategory, action, label); + + // Track as pageview if the "external" location is directly + // related to our library (e.g. click to go to gh repo, click to go to dartdocs, etc.) + if (isAffiliated) { + page = page || label; + ga('send', 'pageview', page); + } +} + +// These link clicks take the user to a 3rd party location, unaffiliated with over_react. +function handleExternalClick(action, label) { + gaLinkHandler(action, label, false); +} + +// These link clicks take the user to a different domain, but one that +// we wish we could track with ga as part of the github.io site... +function handleAffiliatedClick(action, label, page) { + gaLinkHandler(action, label, true, page); +} + +function handleSourceCodeView(componentName) { + handleAffiliatedClick('View Source Code', componentName, gaSourceCodeViewPath + componentName); +} + +function handleBsExternalClick() { + try { + var linkText = arguments.callee.caller.arguments[0].target.innerText; + + handleExternalClick("Click: Hero", linkText); + } catch (err) { + handleExternalClick("Click: Hero", "Bootstrap component"); + } +} + +/////////////////////////////////////////// + var contentPlaceholders = $('.content-placeholder__bg'); var waitFn;