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

Added callback function to send additional data before pageview is sent #12

Merged
merged 2 commits into from
Oct 27, 2015

Conversation

jsteenbeeke
Copy link
Contributor

In our application we want to track a number of custom dimensions in addition to the default statistics logged by Google. This requires us to call ga('set', 'dimensionName', 'value'); before ga('send', 'pageview'); is called (source: https://support.google.com/analytics/answer/2709828). To this end, I've added a custom function to the mixin which is called prior to sending the pageview, with a default empty implementation.

@@ -13,6 +16,8 @@ export default Ember.Mixin.create({
if (trackerType === 'analytics.js') {
var globalVariable = Ember.getWithDefault(ENV, 'googleAnalytics.globalVariable', 'ga');

this.beforePageviewToGA(window[globalVariable]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is not right.

Apparently I didn't have my editor set to correctly autoformat the indentation
@pgrippi
Copy link
Owner

pgrippi commented Oct 27, 2015

lgtm 👍

pgrippi pushed a commit that referenced this pull request Oct 27, 2015
Added callback function to send additional data before pageview is sent
@pgrippi pgrippi merged commit a9d0df9 into pgrippi:master Oct 27, 2015
@pgrippi
Copy link
Owner

pgrippi commented Oct 27, 2015

Version 1.5.0 released on npm with this PR included

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.

3 participants