Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
feat(autotracking): add the transformRouteParams property
Browse files Browse the repository at this point in the history
is now possible to avoid the autotracking to transform all route params into querystrings and add them to the tracked page data
  • Loading branch information
Matteo Gabriele committed Oct 29, 2017
1 parent 7e48f05 commit 7453ace
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const defaultConfig = {
autoTracking: {
exception: false,
page: true,
transformRouteParams: true,
pageviewOnLoad: true,
pageviewTemplate: null,
untracked: true
Expand Down
3 changes: 2 additions & 1 deletion src/lib/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { noop, getQueryString, isRouteIgnored } from '../helpers'

export default function page (...args) {
if (typeof args[0] !== 'string' && 'currentRoute' in args[0]) {
const { transformRouteParams } = config.autoTracking
const route = args[0].currentRoute
const queryString = getQueryString(route.query)
const path = route.path + queryString
const path = route.path + (transformRouteParams ? queryString : '')

set('page', path)
query('send', 'pageview', {
Expand Down

0 comments on commit 7453ace

Please sign in to comment.