Open adammo94 opened 1 year ago
@adammo94 are you encountering a specific error with the above code or just that window.chmln (after calling chmln.identify
) looks a little "odd"? The (t){"...
is expected since the window.chmln plain object is replaced after the full chameleon JS is loaded into the page.
I'd say your implementation looks good to me -- do you need to anything "more" than what you have here?
Yes, here https://help.chameleon.io/en/articles/1228858-how-does-chameleon-work-with-single-page-applications
it's said:
There might be some cases when you might want to clear the Chameleon installation but there's no page refresh taking place.
A common case, for example, is when there's no hard refresh when users log out of your SPA.
Which is exactly my case. I want to use window.chmln.clear, however since window.chmln changed into this (t){"...
thing I cannot access it and it just gives me loads of errors in console when I try .clear
method.
Hello, I have the same issue with chmln.clear
not being present, but that's expected according to the export:
So question is what is wrong, the documentation (stating .clear
should be used with SPA) or the export missing it?
@kovcic Right. chmln
lib doesn t provide other functions
window.chmln.clear
works
@DamirMinkashev @kovcic I see what you're referencing -- if you store and use the reference to "this library", the object you store will not (yet) have the other JavaScript api functions (such as clear, on, etc.). The immediate workaround is to re-reference window.chmln
after the call to init
.
So I have this react (next.js actually) implementation:
however let's say I just open chrome dev tools and when I log in and type in window.chmln or just chmln it returns something like this:
(t){"progeny-definition"!==t&&(e.instanceMethods.init.apply(this,arguments),d.init.apply(this,arguments))}
If I don't use chmln.identify method it (window.chmln inside dev tools' console) works just fine. What am I doing wrong?