o-tracking

Module for tracking FT

active

Json-config

Sample configuration for a product.

<!-- Page level configuration must be included prior to loading the module code -->
<script type="application/json" data-o-tracking-config="">
	{
		"server": "https://test.spoor-api.ft.com/px.gif",
		"context": {
			"product": "origami"
		}
	}
</script>

<p>This page is being tracked automatically.  See the source for more details.</p>

<button onclick="document.body.dispatchEvent(new CustomEvent(&apos;oTracking.page&apos;, { detail: { url: document.URL }, bubbles: true}));">Click to send a page event</button>
<button onclick="document.body.dispatchEvent(new CustomEvent(&apos;oTracking.event&apos;, { detail: { category: &apos;element&apos;, action: &apos;click&apos;, form: &apos;submit&apos; }, bubbles: true}));">Click to track a non-page event</button>

<script>
// Send a custom event
function initLocalScript() {
	oTracking.page({ detail: { url: document.URL }, bubbles: true}));
}
</script>

<!-- Include this to ensure that tracking works even when the page does not load o-tracking's JavaScript -->
<div class="o-tracking o--if-no-js"><div style="background-image: url(...)"></div></div>
Bower Dependencies
ftdomdelegate ^2.0.3
GitHub Repository

Quickstart

Build Service

Add the following to your <script> tag

o-tracking@^1.3.1

How do I do that?

For more information see the Origami build service.

Manual Build Process

Run the following command in the root directory of your project, to add this dependency to your bower.json file:

bower install --save "o-tracking"@"^1.3.1"

For more information see the Origami build process.