# Ionic 4 Capacitor

**URL:** <https://forum.ionicframework.com/t/ionic-4-capacitor/139323>\
**Category:** Ionic Framework\
**Created:** [August 22, 2018, 6:31pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323 "2018-08-22T18:31:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![developergeme](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@developergeme](https://forum.ionicframework.com/u/developergeme)\
**Post date:** [August 22, 2018, 6:31pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/1 "2018-08-22T18:31:45Z")

</div>

I would like to use Google Analytics in my App, and it should be supported in Ionic 4 according to this

> **[GoogleAnalytics - Ionic Docs](https://beta.ionicframework.com/docs/native/google-analytics/)**
>
> Ionic is the app platform for web developers. Build amazing mobile, web, and desktop apps all with one shared code base and open web standards

  
but I am running Capacitor, so can anyone help me with install instructions, as I have installed the native as that is supported by Capacitor according to the documentation, but should I also install the cordova plugin?

No matter if the cordova plugin is installed or not I get this error

![image](https://global.discourse-cdn.com/ionicframework/original/3X/1/a/1a22070470fa252856ed1952e852af1cbc50bca1.png)

and that is this code

![image](https://global.discourse-cdn.com/ionicframework/original/3X/4/1/4131cc72bd71980c168d954404c740b5fe8899a7.png)

so basically the Native wrapper is trying to do something with Cordova.

Anyone know how this is supposed to work?

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [August 22, 2018, 6:34pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/2 "2018-08-22T18:34:49Z")

</div>

Only the 5 or 6 times I copy/paste the exact same answer…anyway

> [@Ionic 4 Beta: Object(...) is not a function](https://forum.ionicframework.com/t/ionic-4-beta-object-is-not-a-function/138152/3):
>
> I like to give the same answer over and over again…so Use ionic-native beta.14 Correct your import by adding /ngx like import {Camera} from '@ionic-native/camera/ngx'; Next time plz before asking search thru the forum first [https://forum.ionicframework.com/t/camera-in-ionic-v4](https://forum.ionicframework.com/t/camera-in-ionic-v4) or [https://forum.ionicframework.com/t/ionic-4-native-plugin-problem](https://forum.ionicframework.com/t/ionic-4-native-plugin-problem)

---

<div class="post-metadata">

**Author:** ![developergeme](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@developergeme](https://forum.ionicframework.com/u/developergeme)\
**Post date:** [August 22, 2018, 6:48pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/3 "2018-08-22T18:48:07Z")

</div>

Thx for taking the time to help. I might have used the wrong search criterias thinking it was a plugin problem

So basically to switch from Cordova to Capacitor I should add /ngx to the import and if that fails like here

![image](https://global.discourse-cdn.com/ionicframework/original/3X/0/a/0a8c4e958957d60f7058863bd9b510944b31a994.png)

I have to get to the correct version of the @ionic-native for that plugin.

And the cordova-plugin should be installed as normally?

---

<div class="post-metadata">

**Author:** ![developergeme](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@developergeme](https://forum.ionicframework.com/u/developergeme)\
**Post date:** [August 22, 2018, 7:01pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/4 "2018-08-22T19:01:04Z")

</div>

To me it looks like that I now have the latest version of Ionic-Native, and that even using ngx is trying to load Cordova

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/e/6/e696e582a5c363c49f0d84bfc67592a58ebfe969.png)

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [August 22, 2018, 7:05pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/5 "2018-08-22T19:05:35Z")

</div>

I think mix up many questions inside the same question, you maybe need to do some more searches first

What I have answered is the fact that the error you were facing is related to ionic-native v5-beta if not correctly imported

Then what’s capacitor how to use capacitor, you could have a look at the documentation [https://capacitor.ionicframework.com](https://capacitor.ionicframework.com)

About how to include a Cordova plugin inside capacitor, I don’t know, never tried so far

About your last screenshot, I guess it’s because you include a cordova plugin in a project where you use capacitor and there is probably something not configured correctly

---

<div class="post-metadata">

**Author:** ![developergeme](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@developergeme](https://forum.ionicframework.com/u/developergeme)\
**Post date:** [August 22, 2018, 7:13pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/6 "2018-08-22T19:13:08Z")

</div>

I have spent hours (reading) now trying to figure out how we should use cordova plugins, where the functionality is still missing in Capacitor, but basically just found a post claiming @ionic-native will be compatible with Capacitor, but no description of how it should work.

Switching to a new version is always hard work, and there are som many new errors to make - mostly mine 🙂

But lets see when I get to the next plugin if the problem is the same.

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [August 22, 2018, 7:23pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/7 "2018-08-22T19:23:18Z")

</div>

Sorry that I couldn’t help more, really. I never tried so far to include cordova plugin in a project where capacitor is used

But note, if it’s a cordova plugin I think it’s not a must to use ionic native, it’s a wrapper, you could do without too (“window.cordova.etc”)

Good luck, hope someone could point you in the right direction

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:22pm UTC](https://forum.ionicframework.com/t/ionic-4-capacitor/139323/8 "2021-07-19T21:22:49Z")

</div>

Closed on July 19, 2021, 9:22pm UTC


