Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config Option to either track page or screenviews #24

Merged
merged 3 commits into from
Feb 19, 2018
Merged

Config Option to either track page or screenviews #24

merged 3 commits into from
Feb 19, 2018

Conversation

cspeer
Copy link
Contributor

@cspeer cspeer commented Feb 19, 2018

You have an undocumented option for trackView that would let anyone using that method manually track the view as either a page or a screenview. I thought it might be useful to have that option globally available when auto-tracking with vueRouter:

Vue.use(VueAnalytics, {
  appName: '<app_name>', // Mandatory
  appVersion: '<app_version>', // Mandatory
  trackingId: '<your_tracking_id>', // Mandatory
  debug: true, // Whether or not display console logs debugs (optional)
  vueRouter: router, // Pass the router instance to automatically sync with router (optional)
  ignoredViews: ['homepage'], // If router, you can exclude some routes name (case insensitive) (optional)
  **trackPage: true|false, // Whether you want page changes to be recorded as pageviews (website) or screenviews (app), default: false**
  globalDimensions: [ // Optional
    {dimension: 1, value: 'MyDimensionValue'},
    {dimension: 2, value: 'AnotherDimensionValue'}
  ],
  globalMetrics: [ // Optional
      {metric: 1, value: 'MyMetricValue'},
      {metric: 2, value: 'AnotherMetricValue'}
    ]
})

Setting that option to true will now dispatch a view as a pageview instead. Hope this helps :)

@ScreamZ
Copy link
Owner

ScreamZ commented Feb 19, 2018

Nice idea, I publish the patch.

Thank you for your contribution.

@ScreamZ ScreamZ closed this Feb 19, 2018
@ScreamZ ScreamZ reopened this Feb 19, 2018
@ScreamZ ScreamZ merged commit dede0ed into ScreamZ:master Feb 19, 2018
@cspeer
Copy link
Contributor Author

cspeer commented Feb 19, 2018

Great! Thanks :) You should probably release a new version to npmjs.com too

@ScreamZ
Copy link
Owner

ScreamZ commented Feb 19, 2018

Already done yes, 1.5.0.

underactive added a commit to underactive/vue-analytics that referenced this pull request Apr 19, 2018
* commit '29e26924f430b7476a47242a9e885ca4db8c3d4a':
  Update build
  Config Option to either track page or screenviews (ScreamZ#24)

# Conflicts:
#	dist/vue-analytics.min.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants