Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwalton committed Jul 18, 2016
1 parent 6324a37 commit c50590c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The `autotrack.js` library is small (6K gzipped), and includes the following plu
</tr>
<tr>
<td><a href="/docs/plugins/clean-url-tracker.md"><code>cleanUrlTracker</code></a></td>
<td>Prevents mutliple different URL paths that point to the same page from appearing in your Google Analytics reports.</td>
<td>Ensures consistency in the URL paths that get reported to Google Analytics; avoiding the problem where separate rows in your pages reports actually point to the same page.</td>
</tr>
<tr>
<td><a href="/docs/plugins/event-tracker.md"><code>eventTracker</code></a></td>
Expand All @@ -54,7 +54,7 @@ The `autotrack.js` library is small (6K gzipped), and includes the following plu
</tr>
<tr>
<td><a href="/docs/plugins/page-visibility-tracker.md"><code>pageVisibilityTracker</code></a></td>
<td>Tracks page visibility state changes, which enables much more accurate session, session duration, and pageview metrics</td>
<td>Tracks page visibility state changes, which enables much more accurate session, session duration, and pageview metrics.</td>
</tr>
<tr>
<td><a href="/docs/plugins/social-widget-tracker.md"><code>socialWidgetTracker</code></a></td>
Expand Down Expand Up @@ -125,7 +125,7 @@ require('autotrack/lib/plugins/url-change-tracker');
// ...
```

The above examples show how to include the plugin source code in your final, generated JavaScript file, which accomlishes the first step of the two-step installation process.
The above examples show how to include the plugin source code in your final, generated JavaScript file, which accomplishes the first step of the two-step installation process.

You still have to update your tracking snippet and require the plugins you want to use:

Expand Down Expand Up @@ -235,6 +235,6 @@ The following translations have been graciously provided by the community. Pleas

If you discover issues with a particular translation, please file them with the appropriate repository. To submit your own translation, follow these steps:

1. Fork this repository
1. Fork this repository.
2. Remove all files other than `README.md` and those in the `docs` folder.
3. Submit a pull request to this repository that adds a link to your translations to the above list.
2 changes: 1 addition & 1 deletion autotrack.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion autotrack.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/common-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Many of the autotrack plugins accept options that are common to multiple differe

Some of the autotrack plugins send hits with default [analytics.js field values](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference) set. These plugins accept a `fieldsObj` option, which allows you to customize those values for each plugin. It also allows you to set any fields that aren't set by default.

The `fieldsObj` option is an `Object` who properties can be any [analytics.js field name](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference), and whose values will be used as the corresponding field value for all hits sent by the plugin.
The `fieldsObj` option is an `Object` whose properties can be any [analytics.js field name](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference), and whose values will be used as the corresponding field value for all hits sent by the plugin.

### Examples

Expand Down Expand Up @@ -101,7 +101,7 @@ ga('require', 'outboundLinkTracker', {

## `hitFilter`

The `hitFilter` option is useful when you need to make more advanced modifications to a hit, or when you need to abort the hit altogether. `hitFilter` is a function that gets invoked with the tracker's [model object](https://developers.google.com/analytics/devguides/collection/analyticsjs/model-object-reference) as its first argument, and, if the hit was initiated from a user interaction with a DOM element, the element as the second argument.
The `hitFilter` option is useful when you need to make more advanced modifications to a hit, or when you need to abort the hit altogether. `hitFilter` is a function that gets invoked with the tracker's [model object](https://developers.google.com/analytics/devguides/collection/analyticsjs/model-object-reference) as its first argument, and (if the hit was initiated by a user interaction with a DOM element) the DOM element as the second argument.

Within the `hitFilter` function you can get the value of any of the model object's fields using the [`get`](https://developers.google.com/analytics/devguides/collection/analyticsjs/model-object-reference#get) method on the `model` argument. And you can set a new value using the [`set`](https://developers.google.com/analytics/devguides/collection/analyticsjs/model-object-reference#set) method on the `model` argument. To abort the hit, throw an error.

Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/clean-url-tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The following table outlines all possible configuration options for the `cleanUr
<td><code>queryDimensionIndex</code></a></td>
<td><code>number</code></a></td>
<td>
There are cases where you want to strip the query string from the URL, but you still want to record what query string was originally there, so you can report on those values separately. You can do this by creating a new <a href=""https://support.google.com/analytics/answer/2709829>custom dimension</a> in Google Analytics. Set the dimension's <a href="https://support.google.com/analytics/answer/2709828#example-hit">scope</a> to "hit", and then set the index of the newly created dimension as the <code>queryDimensionIndex</code> option. Once set, the stripped query string will be set on the custom dimension at the specified index.
There are cases where you want to strip the query string from the URL, but you still want to record what query string was originally there, so you can report on those values separately. You can do this by creating a new <a href="https://support.google.com/analytics/answer/2709829">custom dimension</a> in Google Analytics. Set the dimension's <a href="https://support.google.com/analytics/answer/2709828#example-hit">scope</a> to "hit", and then set the index of the newly created dimension as the <code>queryDimensionIndex</code> option. Once set, the stripped query string will be set on the custom dimension at the specified index.
</td>
</tr>
<tr valign="top">
Expand Down Expand Up @@ -109,7 +109,7 @@ For details on how `analytics.js` plugin methods work and how to invoke them, se

## Example

Given the four URL paths shown in the table at the beginning of this guide, the following `cleanUrlTracker` configuration would ensure that only the URL path `/contact` ever appears in your reports.
Given the four URL paths shown in the table at the beginning of this guide, the following `cleanUrlTracker` configuration would ensure that only the URL path `/contact` ever appears in your reports (assumes you've created a custom dimension for the query at index 1):

```js
ga('require', 'cleanUrlTracker', {
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/event-tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The follow HTML will track right clicks given the above configuration:

### Tracking non-event hit types

The default the `hitType` for all hits sent by the `eventTracker` plugin is `'event'`, but this can be customized either with the [`fieldsObj`](/docs/common-options.md#fieldsobj) or [`hitFilter`](/docs/common-options.md#hitfilter) options, or setting the `ga-hit-type` attribute on the element itself (assuming the default `ga-` attribute prefix).
The default `hitType` for all hits sent by the `eventTracker` plugin is `'event'`, but this can be customized either with the [`fieldsObj`](/docs/common-options.md#fieldsobj) or [`hitFilter`](/docs/common-options.md#hitfilter) options, or setting the `ga-hit-type` attribute on the element itself (assuming the default `ga-` attribute prefix).

For example, to send a [social interaction hit](https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions) instead of an event, you could use the following HTML:

Expand Down
6 changes: 3 additions & 3 deletions docs/plugins/media-query-tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This guide explains what the `mediaQueryTracker` plugin is and how to integrate

Most sites today use responsive design to update the page layout based on the screen size or capabilities of the user's device. If [media queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries) are used to alter the look or functionality of a page, it's important to capture that information to better understand how usage differs when different media queries are active.

The `mediaQueryTracker` plugin allows you to register the set of media query values you're using, and those values are automatically tracked via [custom dimensions](https://support.google.com/analytics/answer/2709828) with each hit. It also sends events those values change.
The `mediaQueryTracker` plugin allows you to register the set of media query values you're using, and those values are automatically tracked via [custom dimensions](https://support.google.com/analytics/answer/2709828) with each hit. It also sends events when those values change.

## Usage

Expand Down Expand Up @@ -209,7 +209,7 @@ ga('require', 'mediaQueryTracker', {

### Customizing the change template and timeout

This code updates the change template to only report the new media value in the event hit. It also eliminates the debounce timeout amount for change events, so hits are sent as soon and as often as changes occur (not recommended):
This code updates the change template to only report the new media value in the event hit. It also increases the debounce timeout amount for change events, so rapid changes have more time to settle before being reported:

```js
ga('require', 'mediaQueryTracker', {
Expand All @@ -227,6 +227,6 @@ ga('require', 'mediaQueryTracker', {
changeTemplate: function(newValue, oldValue) {
return newValue;
},
changeTimeout: 0
changeTimeout: 3000
});
```
6 changes: 3 additions & 3 deletions docs/plugins/page-visibility-tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ga('require', 'pageVisibilityTracker', options);

## Options

The following table outlines all possible configuration options for the `outboundLinkTracker` plugin. If any of the options has a default value, the default is explicitly stated:
The following table outlines all possible configuration options for the `pageVisibilityTracker` plugin. If any of the options has a default value, the default is explicitly stated:

<table>
<tr valign="top">
Expand Down Expand Up @@ -165,12 +165,12 @@ For details on how `analytics.js` plugin methods work and how to invoke them, se

### Ensuring all events are interaction events

This example uses the `fieldsObj` option to set the default `nonInteraction` value for all hits to `false`, which overrides the plugin's default `nonInteraction` value of `true` for hidden events.
This example uses the `fieldsObj` option to set the `nonInteraction` value for all hits to `null`, which overrides the plugin's default `nonInteraction` value of `true` for hidden events. Making this change will dramatically [improve session duration calculations](#improving-session-duration-calculations) as described above.

```js
ga('require', 'pageVisibilityTracker', {
fieldsObj: {
nonInteraction: false
nonInteraction: null
}
});
```
Expand Down
6 changes: 3 additions & 3 deletions lib/plugins/outbound-link-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ function OutboundLinkTracker(tracker, opts) {

/**
* Handles all interactions on link elements. A link is considered an outbound
* link its hostname property does not match location.hostname. When the beacon
* transport method is not available, the links target is set to "_blank" to
* ensure the hit can be sent.
* link if its hostname property does not match location.hostname. When the
* beacon transport method is not available, the links target is set to
* "_blank" to ensure the hit can be sent.
* @param {Event} event The DOM click event.
* @param {Element} link The delegated event target.
*/
Expand Down

0 comments on commit c50590c

Please sign in to comment.