How to use hotjar with ember ?
up vote
-1
down vote
favorite
I need to use hotjar for work, but i have some difficulties to set it up. The project is an ember project, and i have found this project to integrate hotjar : https://github.com/byrnedo/ember-hotjar
In this github page, it says : "in routes and controller you will have _hj.push available", but i can't manage to make it work and i can't find any information about how to set it up.
I added this in config/environment.js :
hotjar: {
id: my-id
},
And in a route, if i do this :
console.log(this.get('_hj'))
I get this result in the console :
ƒ () {
(window.hj.q = window.hj.q || ).push(arguments);
}
Meaning that hotjar is successfully installed, but when i'm trying to something like :
this.get('_hj').push('trigger', 'hello_world');
An error appears saying :
Uncaught TypeError: this.get(...).push is not a function
Does anyone know how to make it work or if i'm making something wrong ?
javascript ember.js statistics hotjar
add a comment |
up vote
-1
down vote
favorite
I need to use hotjar for work, but i have some difficulties to set it up. The project is an ember project, and i have found this project to integrate hotjar : https://github.com/byrnedo/ember-hotjar
In this github page, it says : "in routes and controller you will have _hj.push available", but i can't manage to make it work and i can't find any information about how to set it up.
I added this in config/environment.js :
hotjar: {
id: my-id
},
And in a route, if i do this :
console.log(this.get('_hj'))
I get this result in the console :
ƒ () {
(window.hj.q = window.hj.q || ).push(arguments);
}
Meaning that hotjar is successfully installed, but when i'm trying to something like :
this.get('_hj').push('trigger', 'hello_world');
An error appears saying :
Uncaught TypeError: this.get(...).push is not a function
Does anyone know how to make it work or if i'm making something wrong ?
javascript ember.js statistics hotjar
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I need to use hotjar for work, but i have some difficulties to set it up. The project is an ember project, and i have found this project to integrate hotjar : https://github.com/byrnedo/ember-hotjar
In this github page, it says : "in routes and controller you will have _hj.push available", but i can't manage to make it work and i can't find any information about how to set it up.
I added this in config/environment.js :
hotjar: {
id: my-id
},
And in a route, if i do this :
console.log(this.get('_hj'))
I get this result in the console :
ƒ () {
(window.hj.q = window.hj.q || ).push(arguments);
}
Meaning that hotjar is successfully installed, but when i'm trying to something like :
this.get('_hj').push('trigger', 'hello_world');
An error appears saying :
Uncaught TypeError: this.get(...).push is not a function
Does anyone know how to make it work or if i'm making something wrong ?
javascript ember.js statistics hotjar
I need to use hotjar for work, but i have some difficulties to set it up. The project is an ember project, and i have found this project to integrate hotjar : https://github.com/byrnedo/ember-hotjar
In this github page, it says : "in routes and controller you will have _hj.push available", but i can't manage to make it work and i can't find any information about how to set it up.
I added this in config/environment.js :
hotjar: {
id: my-id
},
And in a route, if i do this :
console.log(this.get('_hj'))
I get this result in the console :
ƒ () {
(window.hj.q = window.hj.q || ).push(arguments);
}
Meaning that hotjar is successfully installed, but when i'm trying to something like :
this.get('_hj').push('trigger', 'hello_world');
An error appears saying :
Uncaught TypeError: this.get(...).push is not a function
Does anyone know how to make it work or if i'm making something wrong ?
javascript ember.js statistics hotjar
javascript ember.js statistics hotjar
asked Nov 20 at 10:36
Gemkodor
12
12
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Uncaught TypeError: this.get(...).push is not a function
Is a result of you attempting to call .push on a function. As in, from your console.log, we can see that this.get('_hj') is a function, and you attempted to call .push on it. You'd get the same error if you tried:
let x = function(){ }
x.push()
Anyway, let's get to the bottom of it. The addon has provided an initializer ember-hotjar that invokes:
import hj from '../hotjar/main';
...
let h = hj.create();
application.register('hotjar:main', h, {instantiate: false});
application.inject('controller', '_hj', 'hotjar:main');
application.inject('route', '_hj', 'hotjar:main');
Whatever hotjar/main exports is used to create h. This is registered in the dependency injection container for ember with the key hotjar:main as a shared object (ie hotjar:main holds a reference to an already instantiated object and not a factory). Then, because of the inject, all routes and all controllers are getting access to said object via this._hj. Please see registration or the injections section of the guides for more information.
So now, we need to investigate the main.js function that is exporting hj
var hj = window.hj = window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)};
...
export default {
create: function () {
return hj;
}
};
this is assigning window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)}; to both hj and window.hj, which ultimately means that in your controller, this._hj === function(){(window.hj.q=window.hj.q||).push(arguments)};
So having seen all of that, I'm not really sure what you're expecting push to do. I think you may just want this._hj('trigger', 'hello_world')? Best of luck
Thanks ! Indeed i only had to do this._hj('trigger', 'hello_world'), that was so simple.. I should have think more, it seems obvious to me now !
– Gemkodor
Nov 20 at 13:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53391106%2fhow-to-use-hotjar-with-ember%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Uncaught TypeError: this.get(...).push is not a function
Is a result of you attempting to call .push on a function. As in, from your console.log, we can see that this.get('_hj') is a function, and you attempted to call .push on it. You'd get the same error if you tried:
let x = function(){ }
x.push()
Anyway, let's get to the bottom of it. The addon has provided an initializer ember-hotjar that invokes:
import hj from '../hotjar/main';
...
let h = hj.create();
application.register('hotjar:main', h, {instantiate: false});
application.inject('controller', '_hj', 'hotjar:main');
application.inject('route', '_hj', 'hotjar:main');
Whatever hotjar/main exports is used to create h. This is registered in the dependency injection container for ember with the key hotjar:main as a shared object (ie hotjar:main holds a reference to an already instantiated object and not a factory). Then, because of the inject, all routes and all controllers are getting access to said object via this._hj. Please see registration or the injections section of the guides for more information.
So now, we need to investigate the main.js function that is exporting hj
var hj = window.hj = window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)};
...
export default {
create: function () {
return hj;
}
};
this is assigning window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)}; to both hj and window.hj, which ultimately means that in your controller, this._hj === function(){(window.hj.q=window.hj.q||).push(arguments)};
So having seen all of that, I'm not really sure what you're expecting push to do. I think you may just want this._hj('trigger', 'hello_world')? Best of luck
Thanks ! Indeed i only had to do this._hj('trigger', 'hello_world'), that was so simple.. I should have think more, it seems obvious to me now !
– Gemkodor
Nov 20 at 13:25
add a comment |
up vote
1
down vote
accepted
Uncaught TypeError: this.get(...).push is not a function
Is a result of you attempting to call .push on a function. As in, from your console.log, we can see that this.get('_hj') is a function, and you attempted to call .push on it. You'd get the same error if you tried:
let x = function(){ }
x.push()
Anyway, let's get to the bottom of it. The addon has provided an initializer ember-hotjar that invokes:
import hj from '../hotjar/main';
...
let h = hj.create();
application.register('hotjar:main', h, {instantiate: false});
application.inject('controller', '_hj', 'hotjar:main');
application.inject('route', '_hj', 'hotjar:main');
Whatever hotjar/main exports is used to create h. This is registered in the dependency injection container for ember with the key hotjar:main as a shared object (ie hotjar:main holds a reference to an already instantiated object and not a factory). Then, because of the inject, all routes and all controllers are getting access to said object via this._hj. Please see registration or the injections section of the guides for more information.
So now, we need to investigate the main.js function that is exporting hj
var hj = window.hj = window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)};
...
export default {
create: function () {
return hj;
}
};
this is assigning window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)}; to both hj and window.hj, which ultimately means that in your controller, this._hj === function(){(window.hj.q=window.hj.q||).push(arguments)};
So having seen all of that, I'm not really sure what you're expecting push to do. I think you may just want this._hj('trigger', 'hello_world')? Best of luck
Thanks ! Indeed i only had to do this._hj('trigger', 'hello_world'), that was so simple.. I should have think more, it seems obvious to me now !
– Gemkodor
Nov 20 at 13:25
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Uncaught TypeError: this.get(...).push is not a function
Is a result of you attempting to call .push on a function. As in, from your console.log, we can see that this.get('_hj') is a function, and you attempted to call .push on it. You'd get the same error if you tried:
let x = function(){ }
x.push()
Anyway, let's get to the bottom of it. The addon has provided an initializer ember-hotjar that invokes:
import hj from '../hotjar/main';
...
let h = hj.create();
application.register('hotjar:main', h, {instantiate: false});
application.inject('controller', '_hj', 'hotjar:main');
application.inject('route', '_hj', 'hotjar:main');
Whatever hotjar/main exports is used to create h. This is registered in the dependency injection container for ember with the key hotjar:main as a shared object (ie hotjar:main holds a reference to an already instantiated object and not a factory). Then, because of the inject, all routes and all controllers are getting access to said object via this._hj. Please see registration or the injections section of the guides for more information.
So now, we need to investigate the main.js function that is exporting hj
var hj = window.hj = window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)};
...
export default {
create: function () {
return hj;
}
};
this is assigning window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)}; to both hj and window.hj, which ultimately means that in your controller, this._hj === function(){(window.hj.q=window.hj.q||).push(arguments)};
So having seen all of that, I'm not really sure what you're expecting push to do. I think you may just want this._hj('trigger', 'hello_world')? Best of luck
Uncaught TypeError: this.get(...).push is not a function
Is a result of you attempting to call .push on a function. As in, from your console.log, we can see that this.get('_hj') is a function, and you attempted to call .push on it. You'd get the same error if you tried:
let x = function(){ }
x.push()
Anyway, let's get to the bottom of it. The addon has provided an initializer ember-hotjar that invokes:
import hj from '../hotjar/main';
...
let h = hj.create();
application.register('hotjar:main', h, {instantiate: false});
application.inject('controller', '_hj', 'hotjar:main');
application.inject('route', '_hj', 'hotjar:main');
Whatever hotjar/main exports is used to create h. This is registered in the dependency injection container for ember with the key hotjar:main as a shared object (ie hotjar:main holds a reference to an already instantiated object and not a factory). Then, because of the inject, all routes and all controllers are getting access to said object via this._hj. Please see registration or the injections section of the guides for more information.
So now, we need to investigate the main.js function that is exporting hj
var hj = window.hj = window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)};
...
export default {
create: function () {
return hj;
}
};
this is assigning window.hj || function(){(window.hj.q=window.hj.q||).push(arguments)}; to both hj and window.hj, which ultimately means that in your controller, this._hj === function(){(window.hj.q=window.hj.q||).push(arguments)};
So having seen all of that, I'm not really sure what you're expecting push to do. I think you may just want this._hj('trigger', 'hello_world')? Best of luck
answered Nov 20 at 13:18
mistahenry
5,27831729
5,27831729
Thanks ! Indeed i only had to do this._hj('trigger', 'hello_world'), that was so simple.. I should have think more, it seems obvious to me now !
– Gemkodor
Nov 20 at 13:25
add a comment |
Thanks ! Indeed i only had to do this._hj('trigger', 'hello_world'), that was so simple.. I should have think more, it seems obvious to me now !
– Gemkodor
Nov 20 at 13:25
Thanks ! Indeed i only had to do this._hj('trigger', 'hello_world'), that was so simple.. I should have think more, it seems obvious to me now !
– Gemkodor
Nov 20 at 13:25
Thanks ! Indeed i only had to do this._hj('trigger', 'hello_world'), that was so simple.. I should have think more, it seems obvious to me now !
– Gemkodor
Nov 20 at 13:25
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53391106%2fhow-to-use-hotjar-with-ember%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown