Skip to content

Commit

Permalink
Add new option documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwalton committed Jun 2, 2017
1 parent 432629f commit a4ac81c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/plugins/clean-url-tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ The following table outlines all possible configuration options for the `cleanUr
<strong>Default:</strong> <code>false</code>
</td>
</tr>
<tr valign="top">
<td><code>queryParamWhitelist</code></td>
<td><code>Array</code></td>
<td>
An array of query params not to strip. This is most commonly used in conjunction with site search, as shown in the <a href=""><code>queryParamWhitelist</code> example</a> below.
</td>
</tr>
<tr valign="top">
<td><code>queryDimensionIndex</code></td>
<td><code>number</code></td>
Expand Down Expand Up @@ -154,6 +161,26 @@ And given those four URLs, the following fields would be sent to Google Analytic
}
```

### Using the `queryParamsWhitelist` option

Unlike campaign (e.g. `utm` params) and adwords (e.g. `glclid`) data, [Site Search](https://support.google.com/analytics/answer/1012264) data is not inferred by Google Analytics from the `location` field when the `page` field is present, so any site search query params *must not* be stripped from the `page` field.

You can preserve individual query params via the `queryParamsWhitelist` option:

```js
ga('require', 'cleanUrlTracker', {
stripQuery: true,
queryParamsWhitelist: ['q'],
});
```

Note that *not* stripping site search params from your URLs means those params will still show up in your page reports. If you don't want this to happen you can update your view's [Site Search setup](https://support.google.com/analytics/answer/1012264) as follows:

1. Specify the same parameter(s) you set in the `queryParamsWhitelist` option.
2. Check the "Strip query parameters out of URL" box.

These options combined will allow you to keep all unwanted query params out of your page reports and still use site search.

### Using the `urlFieldsFilter` option

If the available configuration options are not sufficient for your needs, you can use the `urlFieldsFilter` option to arbirarily modify the URL fields sent to Google Analytics.
Expand Down

0 comments on commit a4ac81c

Please sign in to comment.