Integrating Google Analytics into Ionic 2 Beta 9

Hey guys,

Trying to integrate Google Analytics ( http://ionicframework.com/docs/v2/native/google-analytics/ ) into my app, followed this tutorial as the docs didn’t really have any sort of implementation instructions: https://www.thepolyglotdeveloper.com/2016/03/use-google-analytics-in-an-ionic-2-android-and-ios-app/

However, when I run my app I get the following error while compiling:

TypeScript error: app/app.ts(21,14): Error TS2339: Property ‘analytics’ does not exist on type ‘Window’.

UPDATE aaronksaunders posted a solution: https://github.com/aaronksaunders/GAProject

you could have just posted the link to the repo… https://github.com/aaronksaunders/GAProject

You’re right, sorry about that, didn’t mean any disrespect.

Thanks for the repo.

When adding custom dimensions (addCustomDimension), do we have to place the function call before the trackView like in the regular web Google Analytics?

you may find this link very useful

This above link used Javascript instead of Typescript. Do you have a solution for Google Analytics integration with Typescript?

@slodolceJun

Did you found any solution for that??

please try to declare window variable before @componet

declare var window;

i think its worked…