reywood / meteor-iron-router-ga Goto Github PK
View Code? Open in Web Editor NEWGoogle analytics for Iron Router
License: MIT License
Google analytics for Iron Router
License: MIT License
I guess maybe you should add in the readme that for Meteor Cordova builds you need to add this:
App.accessRule('*.google-analytics.com/*');
to your mobile-config.json
Are there plans to support flow router?
I've just deployed an app to meteor (http://indxd-testdrive.meteor.com/) and am not seeing the GA tracking code added.
I've added reywood:iron-router-ga to my project, configured the router with trackPageView:true, and added my tracking code to settings.json. I deployed with the --settings switch and am seeing the GA tracking ID in the public settings (via "view source"). I also see the GA script include.
The GA Tracking ID control panel, however, still lists my site as "Status: Tracking Not Installed"
Would appreciate any assistance you can provide!
We used this package in a mobile app that we build using meteor and cordova. Now, its only tracking routes that are defined in "routes.js" globally. Most the routes in our app are defined in separate individual modules. Ex: "browse" module has a route file "r_browseroutes.js" defined in "\client\views\modules\browse\helpers" directory. A sample route defined in this file is:
Router.route('/browse-categoryselection',function(){
this.render('browse_categoryselection',{
name : 'browse.categories',
data : {
}
});
});
The GA is not tracking these routes. Not sure whether its GA issue or package issue.
I can't explain why... But adding this package to my project will cause a build of a docker image on CircleCi to fail. I've been happily sending my commits to CircleCi, which then grabs the latest and using the meteorhacks/meteord image, goes and builds a docker image of my app for testing and later deployment. However, when I add this package I get an error like the following:
/root/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:245
throw(ex);
^
Error: EINVAL, chown '/tmp/.tmpywvy0q/reywood_iron-router-ga-0.6.0'
at Object.Future.wait (/root/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:395:16)
...
There's a good ~25 or so other packages I can add or remove with no consequence. It's only this one and the numerals:numerals packages that cause this problem (either of them will give similar errors).
So, any idea what's happening to cause this? For what it's worth it also appears isolated to CircleCi's build env (which utilizes lxc). Unfortunately, I don't know enough about what's truly happening under the covers to be able to provide more info.
Despite having the settings in settings.json I continue to receive this error:
iron-router-ga: settings not found
As a developer, I would like to have the option of using system environment variables to load configuration.
I'm not looking to remove iron-router-ga
's use of Meteor.settings
, but instead looking to add an alternative use of something like IronRouterGa.configure({ ... })
or Router.configure({ ... })
.
The reason for this is because it seems like there is no way that I can find to set the Meteor.settings
from within the codebase and have it get to the client before this package loads.
It also seems pretty common (perhaps a de facto standard) for packages that need configuration to load it using a .config({ ... })
method.
Great package. I think you might want to clarify something though in your readme.
It says you will have access to the ga function anywhere in your Meteor code
, but I'm finding that ga
is only recognized in "client" code.
As someone just discovering the package I assumed this meant your package adds the ga
global variable to the entire Meteor application so that it can be called from "server" code too, but I'm finding ga
isn't defined in "server" code. Try accessing it in the Meteor Shell for example. It would be awesome if this were the case, then we could add GA events for anything happening on the server side too - which sometimes can be something initiated by the client, but isn't necessarily associated with a button click or UI transaction (e.g. some delayed or repeated action).
So it looks like you've added the standard Google Analytics browser var ga
and it's accessible on the client-side only. This is still awesome, but you may want to update your readme as this confused me for a while. With that said, I'm also an analytics newb.
Thanks!
When adding this package, the admin interface in Orion (for collections) fails.
pathFor couldn't find a route named "collections.products.index"
Adding trackPageView to the Router.configure options doesn't work for me.
Debugging my Route calls shows that you only check the passed in options for that route, not the global ones on the configuration object.
If I have my own logic on some routes:
onRun: function() {
//some function of mine
}
Does GA works in this case? Or my function overwrites GA package?
I recently used this package with iron-router on Meteor 1.03. I launched the app with meteor deploy using the setting.josn. The Google analytics script tag does show up in the head but the tracking snippet is not found and GA is not reporting. Here is the site http://tabletlisting.com/.
Hello,
Just wondering, do you make exceptions to not send ga data when testing on localhost?
I can't seem to get GA work. GA complains about that no track id is found. I'll go through what I have done.
mrt add iron-router-ga
trackPageView: true
to the options in Router.configure()
.{
"public": {
"ga": {
"id": "UA-XXXXXXX-Y"
}
}
}
I use meteor-up with phantomJS and the spiderable package. I can read the public meteor settings if I do a curl -i http://my-adress.com
:
I can see this in my resources tab in the developer tools:
Something is fishy. Is there something I have forgotten?
I want to use iron router 1.0 but I can't as this package has a dependency on old iron router. Is this easy to fix?
I am running Meteor 0.9.4 via mup
, which pulls in settings.json
. Everything seems to be set up correctly; my settings have the correct GA ID (and no settings other than ID) and my page is pulling in the Analytics JS. If I execute the following command in the Chrome debugger:
window.ga('send', 'pageview');
... I can see the pageview event on Google Analytic's realtime dashboard. Iron router configuration code is:
Router.configure ->
trackPageView: true
However, if I visit any pages and don't manually send the pageview event, the event is not sent.
Is there any way to specify the name that is being sent for a page view instead of using the path? For example, when loading the path /list/:_id I would like to track this as a "list" page view. Currently /list/:_id is being sent to Google Analytics as the page name.
Thanks
How can we make use of the hitCallback
function?
So Google Analytics allows to track users with a custom app-defined user id. Using this feature, we could track users cross-devices.
Plus, unless I missed anything, it doesn't sound complicated:
function initTracker() {
var createOptions = gaSettings.create || 'auto';
if(createOptions.useMeteorUserId) {
delete createOptions.useMeteorUserId;
if(Meteor.userId()) {
createOptions.userId = Meteor.userId();
}
}
window.ga('create', gaSettings.id, createOptions);
}
Using the iron-router config option on iOS, I turned the device back on and browsed pages while looking at the Real-time monitor on GA. I noticed that pages were not being tracked. After quitting the app and re-opening, it began tracking again.
Any idea what might be causing this?
Hi Sean,
Is that possible to track server side routes?
Thank you!
I expect that most Meteor developer expect their users to be using a modern browser. I propose that for that reason you should use the "Alternative Asynchronous Snippet" as explained here:
https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#localhost
It'll still work on old browsers, so there isn't a compatibility issue.
Is there a way to disable page view tracking for certain logged-in users (e.g. admin users)? I tried this but it threw an error about not being able to use Meteor.userId in a publication, which confused me since I wasn't doing either.
this.route('home', {
path: '/',
trackPageView: (Meteor.user() && Roles.userIsInRole(Meteor.user(), ['admin']) ? false : true
});
Any ideas?
Seems not to work with the iron-router plugin 'ensureSignedIn'.
My rule:
Router.plugin('ensureSignedIn', {
except: ['frontpage','logout', 'termsOfUse', 'atSignIn', 'atSignUp', 'atForgotPwd', 'atResetPwd']
});
As soon as i add "reywood:iron-router-ga", all pages requires login.
I've installed the plugin and setup a UA account but don't get any events sent to GA from iron:router page views.
just wondering what other steps i can take to debug?
when I tried google's own analytics debugger it picks up my GA ID fine
I'm using the GA realtime dashboard to track things.
in the router I also have my own onRun block - but removing that doesn't change anything.
Meteor.startup ->
if Meteor.isClient
Router.configure
trackPageView: true
layoutTemplate: "ionicLayout"
onRun: -> Trix.page()
triggering events manually from the console works and additionally I see a user in the GA dashboard then.
Hi!
How do I properly consider the page meta titles?
http://take.ms/N1Xwu
I've set the experiment quota to 100% of users. However I'm only seeing 1/10th of my visitors in the "experiment sessions" results.
Manually accessing the website on different browsers yields the A/B variation. So I can see it working.
However the experiments code validation says it is not finding the code on the site.
I'm having issues with this library not tracking on Google Analytics. I tried adding the script manually and while this works it doesn't track the iron router path changes. I can verify that analytics.js is loaded on the client and the account key is present in Meteor settings. Is anyone else having issues like this?
Please add support for the new meteor version 0.9.0
Hey there, I noticed within your code:
if (chosenVariation === cxApi.NO_CHOSEN_VARIATION) { + chosenVariation = Math.floor(Math.random() * variationCount); + cxApi.setChosenVariation(chosenVariation, experiment.experimentId) + }
This part randomly selects an chosen variation if the user has not been exposed to an experiment yet. However this does not take advantage of Google's automatic multi-arm bandit algorithm which automatically sends traffic to the best performing variation does it?
When I use "trackPageView: true" (in either Router.configure or the route itself), nothing under "Router.onRun" works. Do you know of a solution, or is that something that needs to be worked on?
Hi guys,
I'm a newbie to ga, so I'm probably stuck with some basic problems. My question here is how ti implement User ID for web tracking like in example:
https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
I understand that when app is creating global ga we need to provide User ID if we want to track users. But, basically this is a iron-router-ga part of the code so I cannot change this.
So my question here is how to do this and what is a best practice to do this?
Thanks
It seems that the code currently overwrites Router.route, whereas it would seem a lot simpler/predictable to just provide an IronRouter plugin.
Thanks for providing this package.
As a newbie to meteor I found it very frustrating to find documentation for Meteor.settings.
IMHO the set up would be much cleaner if the "tracker id" was just defined in Router.configure . Or atleast provide both options with Meteor.settings be an advanced option.
Am I missing something? Is there a reason the tracker code must be set in a settings.json ?
PS. To anyone else lost and reading this, run:
meteor --settings settings.json
or
meteor deploy domain.com --settings settings.json
... yes every time you deploy or run)
For Single Page applications google advise that we send call the 'set page' function when sending a page hit, so that other events (such as social hits) are assigned to the page in question. It would be nice to have this as an option.
https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications
Thanks for creating this package!
Is it possible to programmatically override the GA ID that is set in the config? If so, in which file should that be placed?
The use case is that I need to specify multiple different GA tracking IDs, stored in different properties in my config file, and need to use JavaScript to switch up which one is used so that only the correct one is used.
I've tried creating a file at client/lib/ga.js with the following code ga('create', mySiteIdVar, 'auto');
but it did not override the GA ID set for this package within the config.
While investigating a bug reported for Iron Router i18n (digitalascetic/iron-router-i18n#66) I found out that the bad behavior is caused by a wrong override of Iron Router Router.route
method made by metor-iron-router-ga.
The "signature" of this method is Router.prototype.route = function (path, fn, opts)
because it can be called with options as a second argument or with a function as the second argument and options on the third, meteor-iron-router-ga is just support the first type of call overriding the method as: Router.route = function route(name, options)
.
This is causing Iron Router i18n problems as it uses the complete "signature" for override but it could also cause problems to other people using the second type of call (path, function, options).
Hello!
Is it possible to track multiple pages with multiple tracking codes?
E.g.:
Subpage 1 : Seller of Cars
Visitors on these pages should be tracked with trackingcode 1
Subpage 2 : Seller of Gifts
Visitors on these pages should be tracked with trackingcode 2
Is this possible?
Great plugin, but as a new Meteor user, it would be fantastic to know if my settings have been properly loaded.
I did not properly place the GA id in the "public" section of my Json config. Was a bit of a pain to diagnose. Would have been great to see an error:
"Iron Router GA was not found, please check to make sure you have defined it in the public part of your settings.json".
Great plugin otherwise, running on www.SkyRooms.io ๐ก
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.