# Crashlytics Integration

**URL:** <https://forum.ionicframework.com/t/crashlytics-integration/105882>\
**Category:** ionic-v3\
**Created:** [September 19, 2017, 6:29am UTC](https://forum.ionicframework.com/t/crashlytics-integration/105882 "2017-09-19T06:29:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jhapriti09](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@Jhapriti09](https://forum.ionicframework.com/u/Jhapriti09)\
**Post date:** [September 19, 2017, 6:29am UTC](https://forum.ionicframework.com/t/crashlytics-integration/105882/1 "2017-09-19T06:29:01Z")

</div>

Hey… plz anyone help me how to integrate crashlytics in ionic2 . i installed cordova-fabric-plugin for crashlytics bt i don’t know how to implement in project code… if any one have reference please help out.

Thanks,  
Priti

---

<div class="post-metadata">

**Author:** ![jhaankit](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jhaankit/32/113403_2.png) [@jhaankit](https://forum.ionicframework.com/u/jhaankit)\
**Post date:** [September 19, 2017, 6:56am UTC](https://forum.ionicframework.com/t/crashlytics-integration/105882/2 "2017-09-19T06:56:56Z")

</div>

You could `declare var window` in your provider ts file.  
Like below snippet:

```auto
import {Injectable} from '@angular/core';

declare var window;

@Injectable()
export class ProviderClassName{

}

```

And then access fabric APIs in your provider class.  
Like below snippet:  
`window.fabric.Crashlytics.setUserIdentifier('TheIdentifier')`

---

<div class="post-metadata">

**Author:** ![Jhapriti09](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@Jhapriti09](https://forum.ionicframework.com/u/Jhapriti09)\
**Post date:** [September 19, 2017, 8:53am UTC](https://forum.ionicframework.com/t/crashlytics-integration/105882/3 "2017-09-19T08:53:20Z")

</div>

Thanks for replying me,  
I implement these thing… But how could i identify this is working or not… because i m getting error Runtime Error  
Cannot read property ‘Crashlytics’ of undefined… my app is working properly… plz help me out.

---

<div class="post-metadata">

**Author:** ![jhaankit](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jhaankit/32/113403_2.png) [@jhaankit](https://forum.ionicframework.com/u/jhaankit)\
**Post date:** [September 19, 2017, 3:10pm UTC](https://forum.ionicframework.com/t/crashlytics-integration/105882/4 "2017-09-19T15:10:41Z")

</div>

If you will add `declare var window`, as i have mentioned in above post then ‘Crashlytics’ of undefined error should not come.

Still error coming, then might be you have some issue with installation.  
Please follow as mentioned here : [https://www.npmjs.com/package/cordova-fabric-plugin](https://www.npmjs.com/package/cordova-fabric-plugin)

Do not forget to mention FABRIC\_API\_KEY=XXX & FABRIC\_API\_SECRET=xxx, at the time of adding plugin.

After that, you can remove the platform and add it again.  
I have noticed, CLI fails to update files sometime.

---

<div class="post-metadata">

**Author:** ![Jhapriti09](https://avatars.discourse-cdn.com/v4/letter/j/c4cdca/32.png) [@Jhapriti09](https://forum.ionicframework.com/u/Jhapriti09)\
**Post date:** [September 19, 2017, 3:31pm UTC](https://forum.ionicframework.com/t/crashlytics-integration/105882/5 "2017-09-19T15:31:07Z")

</div>

Thanks a lot ankit… Its working properly
