Comments (5)
We're on Ember 2.14.1, have just installed ember-cli-google-analytics ^1.5.0 as per the installation instructions, and are seeing the same error. We're not using Cordova, it's just a plain Ember app running from the command line and accessed at localhost:4200
.
The error only seems to get thrown when I forcibly refresh the page. Navigating around our app without refreshing doesn't throw any errors, and seems to track as expected.
The line in question (see full stack trace below) is trying to perform the send (window[globalVariable]('send', 'pageview', {
), but my guess is that window.ga
isn't available at that point (which would explain why it only throws the error on a page refresh and not when navigating around).
Interestingly enough, when the error gets thrown, the tracking data still seems to get sent to our GA dashboard.
There was an error running your app in fastboot. More info about the error:
TypeError: window[globalVariable] is not a function
at Class.pageviewToGA (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/ew/mixins/google-pageview.js:22:1)
at Object.applyStr (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:45470:1)
at sendEvent (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:22871:1)
at Class.trigger (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:38519:1)
at invokeWithOnError (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:9035:1)
at Queue.flush (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:8923:1)
at DeferredActionQueues.flush (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:9086:1)
at Backburner.end (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:9165:1)
at Timeout.Backburner._boundAutorunEnd [as _onTimeout] (/sitepath/tmp/broccoli_merge_trees-output_path-0o3SJA8u.tmp/assets/vendor/ember/ember.debug.js:9134:1)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
Update:
Our error was probably down to window
not being available with FastBoot, so we edited our router.js
file to detect window.ga
and conditionally mix in the GA code:
import Ember from 'ember';
import config from './config/environment';
import OtherMixin from 'other-mixin';
import googlePageview from './mixins/google-pageview';
let routerData = {
location: config.locationType,
rootURL: config.rootURL
};
let Router;
if ('ga' in window) {
// Only add GA tracking if it's available (e.g. we're not using FastBoot)
Router = Ember.Router.extend(OtherMixin, googlePageview, routerData);
} else {
Router = Ember.Router.extend(OtherMixin, routerData);
}
Router.map(function() {
// ...
});
export default Router;
from ember-cli-google-analytics.
Also get this error but on line 21. How did you fix this? For me only in combination with cordova the problem appears.
thx
from ember-cli-google-analytics.
I fear I don't remember the details, its too long ago. We updated in the meantime to a newer Ember CLI version and the problem vanished.
Do you still use Ember CLI 0.2.5?
from ember-cli-google-analytics.
I use 1.13.13.
On normal browser all is fine so I guess in my case it might not be a problem with ember at all. I also build a cordova app and on android it breaks. I just hopped that you had a similar problem. :(
from ember-cli-google-analytics.
@BillyRayPreachersSon Thanks :) had the same issue..
from ember-cli-google-analytics.
Related Issues (13)
- Allow analytics to be sent when running on localhost HOT 1
- Add configuration object to ga('send')? HOT 3
- Addon places javascript above CSS code
- Is there any way to enable/disable ganalytics at runtime? HOT 1
- Enhanced Link Attribution
- Content-Security-Policy Warnings HOT 3
- Handle sensitive URLs
- It is not working for me Ember v2.4.0, Ember-CLI v1.13.12
- Retiring this project in favor of @onehilltech/ember-cli-google-analytics
- Unreliable pageview tracking HOT 3
- Default config not set HOT 2
- Enable options to set multiple trackers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-google-analytics.