Skip to content

Commit 9bbc71e

Browse files
author
Dustin Larimer
authored
Merge pull request #87 from keen/dustin-init-auto-tracking
Import AutoCollector
2 parents fed30c3 + aaa5208 commit 9bbc71e

23 files changed

+1571
-114
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
**BREAKING:**
77
**CHANGE:**
88
-->
9+
10+
<a name="1.3.0"></a>
11+
# 1.3.0 Automated Event Tracking (browser-only)
12+
13+
**NEW:**
14+
* Ported functionality from the Web Auto Collector into this SDK: The interface and behaviors of this feature are a little different, but the data models produced are backward compatible (#83)
15+
* New helper: `Keen.helpers.getScrollState()`: Return an object of properties profiling the current scroll state, and optionally pass this object back into the helper again to receive a new object with updated `pixel_max` and `ratio_max` values
16+
* New helper: `Keen.helper.getDomNodeProfile(<ELEMENT>)`: Return an object containing properties profiling a given DOM node
17+
* New utility: `Keen.utils.serializeForm(<FORM>, OPTIONS)`: Serialize the data of a form, with the option to ignore certain input types by passing in a `{ ignoreTypes: ['password'] }` option
18+
19+
**FIXED:**
20+
* Wrap `JSON.parse()` in a `try/catch` block to mitigate error impact when the API returns un-parsable contents (#88)
21+
22+
**UPDATED:**
23+
* Description meta tag content is now part of the `Keen.helpers.getBrowserProfile()` output when present
24+
25+
926
<a name="1.2.1"></a>
1027
# 1.2.1 Fix queue polling
1128

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# keen-tracking.js [![Build Status](https://travis-ci.org/keen/keen-tracking.js.svg?branch=master)](https://travis-ci.org/keen/keen-tracking.js)
22

3-
43
### Installation
54

65
Install this package from npm:
@@ -12,20 +11,20 @@ $ npm install keen-tracking --save
1211
Or load it from our CDN:
1312

1413
```html
15-
<script src="https://d26b395fwzu5fz.cloudfront.net/keen-tracking-1.2.1.min.js"></script>
14+
<script src="https://d26b395fwzu5fz.cloudfront.net/keen-tracking-1.3.0.min.js"></script>
1615
```
1716

1817
[Read about more installation options here](./docs/installation.md)
1918

20-
2119
### Project ID & API Keys
2220

2321
[Login to Keen IO to create a project](https://keen.io/login?s=gh_js) and grab the **Project ID** and **Write Key** from your project's **Access** page.
2422

25-
2623
## Getting started
2724

28-
The following examples demonstrate how to implement rock-solid web analytics, capturing **pageviews**, **clicks**, and **form submissions**. Not interested in web analytics? Use these examples as a primer for getting up and running quickly. These examples also make use of several [helpers](./docs/#helpers) and [utilities](./docs/#utilities) that were designed to address common requirements and help produce insightful, valuable data models.
25+
The following examples demonstrate how to implement rock-solid web analytics, capturing **pageviews**, **clicks**, and **form submissions** with robust data models.
26+
27+
Not interested in web analytics? Use these examples as a primer for getting up and running quickly. These examples also make use of several [helpers](./docs/#helpers) and [utilities](./docs/#utilities) that were designed to address common requirements and help produce insightful, valuable data models.
2928

3029
[Full documentation is available here](./docs/README.md)
3130

@@ -42,8 +41,28 @@ If any of this is confusing, that's our fault and we would love to help. Join ou
4241

4342
---
4443

44+
### Automated Event Tracking (browser-only)
4545

46-
### Setup and Pageview Tracking
46+
Automatically record `pageviews`, `clicks`, and `form_submissions` events with robust data models:
47+
48+
```html
49+
<script src="https://d26b395fwzu5fz.cloudfront.net/keen-tracking-1.3.0.min.js"></script>
50+
<script>
51+
Keen.ready(function(){
52+
var client = new Keen({
53+
projectId: 'YOUR_PROJECT_ID',
54+
writeKey: 'YOUR_WRITE_KEY'
55+
});
56+
client.initAutoTracking();
57+
});
58+
</script>
59+
```
60+
61+
[Learn how to configure and customize this functionality here](./docs/auto-tracking.md)
62+
63+
---
64+
65+
### Pageview Tracking
4766

4867
First, let's create a new `client` instance with your Project ID and Write Key, and use the `.extendEvents()` method to define a solid baseline data model that will be applied to every single event that is recorded. Consistent data models and property names make life much easier later on, when analyzing and managing several event streams. This setup also includes our [data enrichment add-ons](https://keen.io/docs/streams/data-enrichment-overview/), which will populate additional information when an event is received on our end.
4968

@@ -128,8 +147,11 @@ client.recordEvent('pageview', {});
128147

129148
Every event that is recorded will inherit this baseline data model. Additional properties defined in `client.recordEvent()` will be applied before the event is finally recorded.
130149

150+
Want to get up and running faster? This can also be achieved in the browser with [automated event tracking](./docs/auto-tracking.md).
151+
131152
**What else can this SDK do?**
132153

154+
* [Automated tracking (browser-only)](./docs/auto-tracking.md)
133155
* [Record multiple events in batches](./docs/record-events.md)
134156
* [Extend event data models for a single event stream](./docs/extend-events.md)
135157
* [Queue events to be recorded at a given time interval](./docs/defer-events.md)
@@ -187,6 +209,8 @@ Keen.listenTo({
187209
});
188210
```
189211

212+
Want to get up and running faster? This can also be achieved in the browser with [automated event tracking](./docs/auto-tracking.md).
213+
190214
---
191215

192216
### Block Bots and Improve Device Recognition
@@ -219,6 +243,8 @@ client.extendEvents(() => {
219243

220244
Check out the many additional methods supported by [mobile-detect.js](https://github.com/hgoebl/mobile-detect.js) to further enrich your data model.
221245

246+
This can also be used with [automated event tracking](./docs/auto-tracking.md).
247+
222248
---
223249

224250
### Contributing

0 commit comments

Comments
 (0)