angulartics / angulartics2

Vendor-agnostic analytics for Angular2 applications.
MIT License
1.01k stars 193 forks source link

ERROR ReferenceError: clicky is not defined #360

Open Zaniyar opened 5 years ago

Zaniyar commented 5 years ago

I am trying to use clicky on my project. But I get this error.

ERROR ReferenceError: clicky is not defined
    at Angulartics2Clicky.pageTrack (angulartics2-clicky.js:31)
    at SafeSubscriber._next (angulartics2-clicky.js:17)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:183)
    at SafeSubscriber.next (Subscriber.js:122)
    at Subscriber._next (Subscriber.js:72)
    at Subscriber.next (Subscriber.js:49)
    at FilterSubscriber._next (filter.js:33)
    at FilterSubscriber.next (Subscriber.js:49)
    at ReplaySubject.next (Subject.js:39)
    at ReplaySubject.nextInfiniteTimeWindow (ReplaySubject.js:29)

Before I got to the error above, I had these errors, which prevented from run:

eeinject not found

in node_modules\angulartics2\fesm2015\angulartics2.js node_modules\angulartics2\clicky\fesm2015\angulartics2-clicky.js

after removing the "ee" from each "eedefinedInjectable" and "eeinject" I could run the project and then in the browser console I got the "clicky is not defined" error.

scttcper commented 5 years ago

make sure the version of angular you're using is compatible https://github.com/angulartics/angulartics2/blob/master/README.md#dependencies

Zaniyar commented 5 years ago

@scttcper I think I am using the right versions:

"@angular-redux/store": "^9.0.0",
"@angular/animations": "^7.0.0",
"@angular/cdk": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/core": "^7.0.0",
**"angulartics2": "^7.5.2",**
scttcper commented 5 years ago

I got nothing dog

takahser commented 4 years ago

I get the same error when using clicky with angular universal. The error happens when running the prerender task which is executed in a node environment. Hence, the scripts are not properly loaded and the clicky symbol doesn't exist.

Is there any way to disable clicky conditionally (i.e. in this case when execution happens in a node environment)?