Closed varosengineer closed 1 year ago
Hello @varosengineer,
Are you using Ionic with Capacitor? Did you get any errors while adding the plugins?
Hello @varosengineer,
Are you using Ionic with Capacitor? Did you get any errors while adding the plugins?
Sorry, @ibradwan, I didn't mention it. Yes, my project is based on Ionic with Capacitor.
According to the documentation the following code has to be added somewhere unspecified (I guess it depends on the project):
declare let ClarityPlugin: any;
var success = function(message: string) {}
var failure = function(message: string) {}
ClarityPlugin.initialize("<ProjectId>", success, failure, true);
In my project I'm not clear where to add it, but in my previous post you have the details.
The error I get is Uncaught ReferenceError: ClarityPlugin is not defined
, and causes the web version of the application to stop working.
Thank you in advance.
Hi @varosengineer, We are aware of this issue and are working on it. It is due to Cordova Plugins not being supported on the Web Platform for Ionic with Capacitor [Github Issue]. For the time being, you could limit the plugin scope to just Android (as it is the platform currently supported by Clarity for Apps).
if(Capacitor.getPlatform() === "android"){
declare let ClarityPlugin: any;
var success = function(message: string) {}
var failure = function(message: string) {}
ClarityPlugin.initialize("<ProjectId>", success, failure, true);
}
Was this ever resolved? I am still facing the same issue.....
@askchrisn Did you try the workaround suggested above?
I followed the usage instructions given in https://www.npmjs.com/package/cordova-clarity, although I don't know if I did it correctly because it doesn't specify where the code snippet should be placed. In my case I put the code in the
src/main.ts
file of the application:However, I get the following error:
Can someone help me set it up?