Add support for sending virtual pageviews on search events

Signed-off-by: Nikita Karpukhin <nikita.karpukhin@scout24.com>
This commit is contained in:
Nikita Karpukhin
2022-11-28 16:32:51 +01:00
parent 4e12e8a023
commit 9516b0c355
6 changed files with 216 additions and 1 deletions
+25
View File
@@ -169,6 +169,31 @@ export const apis: AnyApiFactory[] = [
];
```
### Enabling Site Search
If you wish to see all of the search events in the [Site Search](https://support.google.com/analytics/answer/1012264)
section of Google Analytics, you can enable sending virtual pageviews on every `search` event like so:
```yaml
app:
analytics:
ga:
virtualSearchPageView:
mode: only # Defaults to 'disabled'
mountPath: /virtual-search # Defaults to '/search'
queryParam: term # Defaults to 'query'
```
Available `mode`s are:
- `disabled` - no virtual pageviews are sent, default behavior
- `only` - sends virtual pageviews _instead_ of `search` events
- `both` - sends both virtual pageviews _and_ `search` events
Virtual pageviews will be sent to the path specified in the `mountPath`, and the search term will be
set as the value for query parameter `queryParam`, e.g. the example config above will result in
virtual pageviews being sent to `/virtual-search?term=SearchTermHere`.
### Debugging and Testing
In pre-production environments, you may wish to set additional configurations