Code Monkey home page Code Monkey logo

nativescript-google-analytics's People

Contributors

astagi avatar eddyverbruggen avatar guillaume-roy avatar leocaseiro avatar markhatchell avatar michaelsolati avatar nathanaela avatar piotrilski avatar sbd580 avatar sitefinitysteve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nativescript-google-analytics's Issues

Conflict w/ nativescript-google-maps-sdk plugin

First of all, awesome plugin. Thanks for that!

Second, there seems to be a conflict between the nativescript-google-maps-sdk plugin and the nativescript-googleanalytics plugin. The nativescript-googleanalytics plugin is referencing the google play services 8.4.0 but the nativescript google maps sdk plugin is referencing the newest google play services version installed.

I talked w/ the nativescript-google-maps-sdk plugin developer @dapriett and he thought it might be best to add the following line to your plugin so it always targets the latest installed version?
compile 'com.google.android.gms:play-services-maps:+'

Thoughts? Here's the issue I have on his plugin:
dapriett/nativescript-google-maps-sdk#34 (comment)

Can't find variable: GAIDictionaryBuilder

We're getting a weird error in iOS all of a sudden when trying to invoke logView("Home") method. Has anyone run into this before? Our code was working previously, but for some reason now new builds aren't working.

JavaScript stack trace:
1 logView@file:///app/tns_modules/nativescript-google-analytics/index.js:52:37
2 pageLoaded@file:///app/components/homeView/homeView.js:25:28
3 notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:149:31
4 _emit@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:168:24
5 onLoaded@file:///app/tns_modules/tns-core-modules/ui/core/view-common.js:743:19
6 onLoaded@file:///app/tns_modules/tns-core-modules/ui/page/page-common.js:53:39
7 onLoaded@file:///app/tns_modules/tns-core-modules/ui/page/page.js:260:43
8 viewWillAppear@file:///app/tns_modules/tns-core-modules/ui/page/page.js:150:26
9 UIApplicationMain@[native code]
10 start@file:///app/tns_modules/tns-core-modules/application/application.js:251:30
11 anonymous@file:///app/app.js:67:18
12 evaluate@[native code]
13 moduleEvaluation@[native code]
14 @[native code]
15 promiseReactionJob@[native code]
JavaScript error:
file:///app/tns_modules/nativescript-google-analytics/index.js:52:37: JS ERROR ReferenceError: Can't find variable: GAIDictionaryBuilder

Plugin won't compile using nativescript 4

I recently updated to nativescript 4.0.
And the plugin stopped working, I even created a new project and installed the plugin and still won't compile

"Failed to build plugin nativescript-social-share : Error: Command failed: ./gradlew -p /home/brainex/Projects/mp3faka/platforms/tempPlugin/nativescript_social_share assembleRelease -PcompileSdk=android-25 -PbuildToolsVersion=26.0.2 -PsupportVersion=25.3.1"

Add Android Play Libs to README

Open the Android Studio SDK manager, make sure all of your build tools are up to date. Then make sure your Google Play Services and Google Repository packages are up to date. In the Android Studio sdk manager, you'll find these under the "SDK Tools" tab. If you are using the standalone sdk manager, you would scroll down to the "Extras" section at the bottom and update them there

Add Support For UserID Tracking

Would be great to add support for UserID Based tracking as noted Here

It looks like you have even aready started to implement it based off of some of the code that is commented out in each platforms index files.

userId not available at delegate

Is it possible to initialise the userId, after the delegate? Basically I don't know what the userId is when the app is starting.

Best regards
Patrick

Webpack compatibility ios

Hi @sitefinitysteve, thank you for this amazing plugin.

I'm having issues with WebPack. It's working fine without bundling it, but if we bundle, the app won't start, and we get the error:

CONSOLE ERROR file:///app/tns_modules/zone.js/dist/zone-node.js:419:27: Unhandled Promise rejection: Value is not a class. ; Zone: <root> ; Task: null ; Value: Error: Value is not a class.

CONSOLE ERROR file:///app/tns_modules/zone.js/dist/zone-node.js:421:23: Error: Uncaught (in promise): Error: Value is not a class. 

I believe it's related to the issue NativeScript/nativescript-dev-webpack#8 which is caused by the __extends().

Do you know an easy fix for that? Thanks

NPM version outdated?

Hi,

Is it possible that the version found in NPM although at 0.3.2 still include a specific version of google-services?

Shay

Another error on Nativescript 4+ with plugin 0.4.3 version

Another error after update plugin to 0.4.3 version

Error is: Failed to build plugin nativescript-google-analytics :
Error: Command gradlew.bat failed with exit code 1 Error output:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
> Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 15s

Failed to apply plugin [id 'com.google.gms.google-services'] when used together with nativescript-push-notifications

Hi I noticed both plugins generate some conflict when used together, and not sure which one is the best to log the issue or the most appropriate to make and adjustment/suggestion ?

Sorry for the inconvenience if the problem is related to the push-notifications plugin.

The problem as the title says is the version of google-services.
For reproduction:

tns create Sample --ng
cd Sample
tns plugin add nativescript-google-analytics
tns plugin add nativescript-push-notifications
cp ...../google-services.json app/App_Resources/Android/
tns run android

and you will get:

What went wrong:
A problem occurred evaluating root project 'Sample'.
> Failed to apply plugin [id 'com.google.gms.google-services']
   > For input string: "+"

Here is the complete trace:

MacBook-Pro-de-Ignacio:tmp ignacio$ tns create Sample --ng
Installing  tns-template-hello-world-ng
/private/tmp/Sample
└─┬ [email protected] 
  ├── @angular/[email protected] 
  ├── @angular/[email protected] 
  ├── @angular/[email protected] 
  ├── @angular/[email protected] 
  ├── @angular/[email protected] 
  ├── @angular/[email protected] 
  ├── @angular/[email protected] 
  ├── @angular/[email protected] 
  ├─┬ [email protected] 
  │ ├── [email protected] 
  │ ├── [email protected] 
  │ ├── [email protected] 
  │ ├── [email protected] 
  │ ├── [email protected] 
  │ └── UNMET PEER DEPENDENCY zone.js@^0.7.2
  ├── [email protected] 
  ├── [email protected] 
  ├─┬ [email protected] 
  │ └── [email protected] 
  └── UNMET PEER DEPENDENCY zone.js@^0.7.2


/private/tmp/Sample
└─┬ [email protected] 
  └── [email protected] 



> [email protected] postinstall /private/tmp/Sample/node_modules/nativescript-dev-android-snapshot
> node postinstall.js


> [email protected] postinstall /private/tmp/Sample/node_modules/nativescript-dev-typescript
> node postinstall.js

Project already targets TypeScript ~2.1.0
/private/tmp/Sample
├─┬ [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├─┬ [email protected] 
│ │ │ ├─┬ [email protected] 
│ │ │ │ └── [email protected] 
│ │ │ ├── [email protected] 
│ │ │ ├─┬ [email protected] 
│ │ │ │ └─┬ [email protected] 
│ │ │ │   ├── [email protected] 
│ │ │ │   └── [email protected] 
│ │ │ ├── [email protected] 
│ │ │ └── [email protected] 
│ │ └─┬ [email protected] 
│ │   └── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
├── [email protected] 
└── [email protected] 


Project Sample was successfully created.

MacBook-Pro-de-Ignacio:tmp ignacio$ cd Sample/
MacBook-Pro-de-Ignacio:Sample ignacio$ tns plugin add nativescript-google-analytics
/private/tmp/Sample
└── [email protected] 


Successfully installed plugin nativescript-google-analytics.
MacBook-Pro-de-Ignacio:Sample ignacio$ tns plugin add nativescript-push-notifications

> [email protected] postinstall /private/tmp/Sample/node_modules/nativescript-push-notifications
> node postinstall.js

/private/tmp/Sample
└── [email protected] 


Successfully installed plugin nativescript-push-notifications.
MacBook-Pro-de-Ignacio:Sample ignacio$ cp /Users/ignacio/Workspaces/DuenoVende/hezea-app/app/App_Resources/Android/google-services.json app/App_Resources/Android/
MacBook-Pro-de-Ignacio:Sample ignacio$ tns run android
Copying template files...
  ◞ Installing tns-androidInstalling  tns-android
  ◝ Installing tns-android/private/tmp/Sample
└── [email protected] 


  ◠ Installing tns-android/private/tmp/Sample
└─┬ [email protected] 
  ├─┬ [email protected] 
  │ ├─┬ [email protected] 
  │ │ ├── [email protected] 
  │ │ ├── [email protected] 
  │ │ ├─┬ [email protected] 
  │ │ │ └── [email protected] 
  │ │ ├── [email protected] 
  │ │ └── [email protected] 
  │ ├── [email protected] 
  │ └── [email protected] 
  ├── [email protected] 
  ├─┬ [email protected] 
  │ ├── [email protected] 
  │ └── [email protected] 
  ├─┬ [email protected] 
  │ └── [email protected] 
  ├── [email protected] 
  ├─┬ [email protected] 
  │ └── [email protected] 
  ├── [email protected] 
  ├─┬ [email protected] 
  │ └── [email protected] 
  └── [email protected] 


  ◜ Installing tns-android/private/tmp/Sample
└── [email protected] 


  ◜ Installing tns-android/private/tmp/Sample
└── [email protected] 


  ◜ Installing tns-android/private/tmp/Sample
└── [email protected] 


Project successfully created.
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.1.6
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-push-notifications.js
Preparing project...

:config phase:  createDefaultIncludeFiles

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/widgets-release.aar
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
Incremental java compilation is an incubating feature.
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:clean

BUILD SUCCESSFUL

Total time: 6.062 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.10/userguide/gradle_daemon.html
Successfully prepared plugin nativescript-angular for android.
Successfully prepared plugin nativescript-intl for android.
Successfully prepared plugin nativescript-google-analytics for android.
Successfully prepared plugin nativescript-push-notifications for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Project successfully prepared (android)
Executing after-prepare hook from /private/tmp/Sample/hooks/after-prepare/nativescript-dev-android-snapshot.js
Searching for devices...
Building project...

:config phase:  createDefaultIncludeFiles
	+found plugins: nativescript-google-analytics
Renaming plugin directory to flavor name: /private/tmp/Sample/platforms/android/src/nativescript-google-analytics -> /private/tmp/Sample/platforms/android/src/F0
	+found plugins: nativescript-push-notifications
Renaming plugin directory to flavor name: /private/tmp/Sample/platforms/android/src/nativescript-push-notifications -> /private/tmp/Sample/platforms/android/src/F1
	+found plugins: tns-core-modules-widgets
	 + creating include.gradle file for /private/tmp/Sample/platforms/android/configurations/tns-core-modules-widgets
Renaming plugin directory to flavor name: /private/tmp/Sample/platforms/android/src/tns-core-modules-widgets -> /private/tmp/Sample/platforms/android/src/F2

:config phase:  createPluginsConfigFile
	 Creating product flavors include.gradle file in /private/tmp/Sample/platforms/android/configurations folder...

:config phase:  pluginExtend
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/include.gradle
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/nativescript-google-analytics/include.gradle
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/nativescript-push-notifications/include.gradle
	+applying configuration from: /private/tmp/Sample/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/widgets-release.aar

FAILURE: Build failed with an exception.

* Where:
Build file '/private/tmp/Sample/platforms/android/build.gradle' line: 802

* What went wrong:
A problem occurred evaluating root project 'Sample'.
> Failed to apply plugin [id 'com.google.gms.google-services']
   > For input string: "+"

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.916 secs
Command /private/tmp/Sample/platforms/android/gradlew failed with exit code 1
# run android

┌───────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage                         │ Synopsis                                                                                                           │
│ Run on all connected devices  │ $ tns run android [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key     │
│ and running emulators         │ -store-alias-password <Password>] [--release] [--justlaunch]                                                       │
│ Run on a selected connected   │ $ tns run android --device <Device ID> [--key-store-path <File Path> --key-store-password <Password> --key-store   │
│ device or running emulator    │ -alias <Name> --key-store-alias-password <Password>] [--release] [--justlaunch]                                    │
│ Start an emulator and run the │ $ tns run android --emulator [<Emulator Options>] [--key-store-path <File Path> --key-store-password <Password> -  │
│ app inside it                 │ -key-store-alias <Name> --key-store-alias-password <Password>] [--release] [--justlaunch]                          │
└───────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Runs your project on a connected Android device or in a native Android emulator, if configured. This is shorthand for prepare, build and deploy. While your app is running, prints the output from the application in the console and watches for changes in your code. Once a change is detected, it synchronizes the change with all selected devices and restarts/refreshes the application.

### Options

    * --no-watch - If set, changes in your code will not be reflected during the execution of this command.
    * --device - Specifies a connected device/emulator on which to run the app.
    * --emulator - If set, runs the app in a native emulator for the target platform, if configured. When set, you can also set any other valid combination of emulator options as listed by $ tns help emulate android.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --justlaunch - If set, does not print the application output in the console.
    * --clean - If set, forces rebuilding the native application.

### Attributes

    * <Device ID> is the index or name of the target device as listed by $ tns device android
    * <Emulator Options> is any valid combination of options as listed by $ tns help emulate android

Sending exception report (press Ctrl+C to stop).....

I think the problem might be related to this, but just guessing:

:config phase:  addAarDependencies
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/pushplugin.aar
	+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/widgets-release.aar
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.

Not working on android - Cannot read property 'setScreenName' of undefined'

How do you set this up for android?

I tried to follow the example in the demo folder although I'm using typescript with angular and it works on ios but not on android wher I get Cannot read property 'setScreenName' of undefined' (although the pageview doesn't really log since it's a hack to setup a mobile app expecting the tracking code of a website).

Any ideas?

Error in index.d.ts: not a module

Everytime i run my application I recieve the following error:

error TS2656: Exported external package typings file 'PATH/node_modules/nativescript-google-analytics/index.d.ts' is not a module. Please contact the package author to update the package definition.

Plugin error compile using new Nativescript 4

Error is: Failed to build plugin nativescript-google-analytics :
Error: Command gradlew.bat failed with exit code 1 Error output:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
> Could not find play-services-base.aar (com.google.android.gms:play-services-base:15.0.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-base/15.0.1/play-services-base-15.0.1.aar
> Could not find play-services-stats.aar (com.google.android.gms:play-services-stats:15.0.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-stats/15.0.1/play-services-stats-15.0.1.aar
> Could not find play-services-tasks.aar (com.google.android.gms:play-services-tasks:15.0.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/15.0.1/play-services-tasks-15.0.1.aar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 48s

Error when building on Android

When i try to tns build android, i get the following error :

Could not find com.google.android.gms:play-services-analytics:8.4.0

I followed the Google instructions but if i see the include.gradle including in your package, i notice two differences :

  • Google says to add com.google.gms:google-services:2.0.0-alpha6 or your added the beta6
  • Google says to apply plugin: 'com.google.gms.google-services' and i don't see this line anywhere

I have configured, downloaded and saved the google-services.json in app/App_Resources/Android.

  • Windows 10
  • tns-core-modules 1.7.1
  • tns-android 1.7.1

Allow override version of play services

Hi,

When trying to apply "com.google.gms.google-services" (apply plugin: "com.google.gms.google-services"), which other plugin is doing (nativescript-plugin-firebase) I'm getting this error:

A problem occurred evaluating script.
> Failed to apply plugin [id 'com.google.gms.google-services']
   > For input string: "+" 

Please allow override the version of play services with a project variable (googlePlayServicesVersion) which is already in used in several other plugins. for example:

https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/platforms/android/include.gradle
https://github.com/dapriett/nativescript-google-maps-sdk/blob/master/platforms/android/include.gradle

Thanks

Error: fontVariationSettings and ttcIndex

"tns-ios": { "version": "4.2.0" }, "tns-android": { "version": "4.2.0" }
Unable to apply changes on device: emulator-5554. Error is: Failed to build plugin nativescript-google-analytics :
Error: Command ./gradlew failed with exit code 1 Error output:
/Users/nalexeev/.gradle/caches/transforms-1/files-1.1/core-1.0.0.aar/fdc1653b7147869a0140773583eb43f4/res/values/values.xml:133:5-70:AAPT: error: resource android:attr/fontVariationSettings not found.

/Users/nalexeev/.gradle/caches/transforms-1/files-1.1/core-1.0.0.aar/fdc1653b7147869a0140773583eb43f4/res/values/values.xml:133:5-70: AAPT: error: resource android:attr/ttcIndex not found.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':verifyReleaseResources'.

com.android.ide.common.process.ProcessException: Failed to execute aapt

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s

No Config File Instrcutions

In the readme you say to click "Get a Configuration File" which does not exist anywhere on GA pages. For iOS am I supposed to follow these?

Analytics uses CocoaPods to install and manage dependencies. Open a terminal window and navigate to the location of the Xcode project for your application. If you have not already created a Podfile for your application, create one now:

pod init
Open the Podfile created for your application and add the following:

pod 'GoogleAnalytics'
Save the file and run:

pod install
This creates an .xcworkspace file for your application. Use this file for all future development on your application.

Android: Could not find com.google.android.gms:play-services-analytics:9.2.0.

When building for Android using v0.2.9 the following error occurs:

Could not find com.google.android.gms:play-services-analytics:9.2.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.jar
file:/Users/dgaud/Sites/renet/platforms/android/libs/aar/play-services-analytics-9.2.0.jar
file:/Users/dgaud/Sites/renet/platforms/android/libs/aar/play-services-analytics.jar
https://jitpack.io/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.pom
https://jitpack.io/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.jar
file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.pom
file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.jar
file:/usr/local/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.pom
file:/usr/local/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-analytics/9.2.0/play-services-analytics-9.2.0.jar.

To resolve this I changed the following line in the include.gradle file:
compile 'com.google.android.gms:play-services-analytics:9.2.0' to compile 'com.google.android.gms:play-services-analytics:+

Note: iOS runs with no errors.

'ERROR TypeError: Cannot read property 'setScreenName' of undefined' after upgrading to Angular 6.1.0

Hi,

After upgrading a project to the latest NativeScript 4.2.2 and Angular 6.1.0. I am seeing this error on Android once I use the logView() method. Here is the full package.json of dependencies:

"dependencies": {
    "@angular/common": "~6.1.0",
    "@angular/compiler": "~6.1.0",
    "@angular/core": "~6.1.0",
    "@angular/forms": "~6.1.0",
    "@angular/http": "~6.1.0",
    "@angular/platform-browser": "~6.1.0",
    "@angular/platform-browser-dynamic": "~6.1.0",
    "@angular/router": "~6.1.0",
    "@ngrx/store": "4.1.1",
    "nativescript-angular": "^6.0.0",
    "nativescript-camera": "4.0.2",
    "nativescript-floatingactionbutton": "4.1.3",
    "nativescript-fresco": "4.0.0",
    "nativescript-google-analytics": "0.4.4",
    "nativescript-image-swipe": "3.0.0",
    "nativescript-imagepicker": "6.0.3",
    "nativescript-iqkeyboardmanager": "1.1.0",
    "nativescript-orientation": "^2.2.0",
    "nativescript-ui-listview": "^3.5.11",
    "nativescript-ui-sidedrawer": "^4.3.0",
    "reflect-metadata": "0.1.10",
    "rxjs": "~6.1.0",
    "rxjs-compat": "^6.2.2",
    "tns-core-modules": "^4.2.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~6.1.0",
    "@ngtools/webpack": "~6.1.0",
    "nativescript-dev-typescript": "~0.7.2",
    "nativescript-dev-webpack": "^0.15.1",
    "tns-platform-declarations": "4.2.0",
    "typescript": "~2.8.2"
  },

Error

Refreshing application...
Successfully synced application com.cobbl.app on device 01a5bd7074a39516.
JS: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
JS: ERROR TypeError: Cannot read property 'setScreenName' of undefined
JS: ERROR CONTEXT {
JS:   "view": {
JS:     "def": {
JS:       "nodeFlags": 37994497,
JS:       "rootNodeFlags": 33554433,
JS:       "nodeMatchedQueries": 0,
JS:       "flags": 0,
JS:       "nodes": [
JS:         {
JS:           "nodeIndex": 0,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputIndex": 0,
JS:           "checkIndex": 0,
JS:           "flags": 33554433,
JS:           "childFlags": 4440064,
JS:           "directChildFlags": 4440064,
JS:           "childMatchedQueries": 0,
JS:           "matchedQueries": {},
JS:           "matchedQueryIds": 0,
JS:           "references": {},
JS:           "ngContentIndex": null,
JS:           "childCount": 1,
JS:           "bindings": [],
JS:           "bindingFlags": 0,
JS:           "outputs": [],
JS:           "element": {
JS:             "ns": "",
JS:             "name": "ng-component",
JS:             "attrs": [],
JS:             "template": null,
JS:             "componentProvider": {
JS:               "nodeIndex": 1,
JS:               "parent": "[Circular]",
JS:               "renderParent": "[Circular]",
JS:               "bindingIn...
JS: To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG

The issue seams to be caused by an change in the way the ngOnInit is being resolved in the newest version of Angular. What happens is that the call of the ngOnInit is called before the launchEvent lifecycle event is raised in which I am calling the initalize(). The callbacks in latest versions of Angular is:

  • the bootstrapped component's ngOnInit
  • after that the launchEvent of the application lifecycle

And it used to be:

  • the launchEvent of the application lifecycle
  • after that the bootstrapped component's ngOnInit

Plugin not working in my app

Hi,
I use nativescript angular version
my app.component.ts content:

import { Component, OnInit } from "@angular/core";
import * as googleAnalytics from 'nativescript-google-analytics';

@Component({
    selector: "ns-app",
    templateUrl: "app.component.html",
})

export class AppComponent implements OnInit {
    ngOnInit() {
        this.initAnalytics();
    }
    initAnalytics() {
        googleAnalytics.initalize({
            trackingId: 'MYCODE',
            dispatchInterval: 5,
            logging: true
        });
    }
}

I run app and see google analytics but no user active.
Please help me what is the wrong my code.
I create analytics app generate tracking code and insert to MYCODE
Thanx for your help.
Bumbella

Attribute application@appComponentFactory value=XXX from [XXX] is also present at [XXX]

Building app produces the following gradle error:

Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
        is also present at [androidx.core:core:1.0.0]

As suggested I added this into AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
	xmlns:tools="http://schemas.android.com/tools">

<application tools:replace="android:appComponentFactory"
        android:appComponentFactory="androidx>

...but it did not help.

I have a new error:

Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list:
  Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

I do use multiDexEnabled true so I don't know why it's crying about duplicate classes.

tns-android v5.2.1
minSDK 17
targetSdkVersion 28 (28.0.0)

Installing with TypeScript

Anyone tried to install that plugin on {N}'s TypeScript version?
Currently docs provide only regular JS code

Error calling logException on iOS

First let me say thanks for writing this plugin! When we were picking which framework to go with at work I experimented with GA on NS and I wasn't excited about writing my own.

Anyway, on a brand new Angular 2 NativeScript project based on the hello world template (tns create --ng), following your example for initializing, the app crashes when trying to log an exception on iOS (Android is fine).

The short error is: JS ERROR Error: This value is not a native object.

In a simple (tap) function this code is used:

    let exception: LogExceptionOptions = <LogExceptionOptions>{
            description: `Button has been clicked ${this.count + 1} times!`,
            fatal: false
    };

    googleAnalytics.logException(exception);

And here's the console output from Zombies:

CONSOLE LOG file:///app/app.module.js:49:28: iOS {"line":96,"column":35,"sourceURL":"file:///app/tns_modules/nativescript-google-analytics/index.js"}
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x10d33c7cb NativeScript::FFICallbackNativeScript::ObjCMethodCallback::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2 0x10da111ee ffi_closure_unix64_inner
3 0x10da11b22 ffi_closure_unix64
4 0x10e665c38 -[UIControl sendAction:to:forEvent:]
5 0x10e665f51 -[UIControl _sendActionsForEvents:withEvent:]
6 0x10e664e4d -[UIControl touchesEnded:withEvent:]
7 0x10e54d545 -[UIWindow _sendTouchesForEvent:]
8 0x10e54ec33 -[UIWindow sendEvent:]
9 0x10e4fb9ab -[UIApplication sendEvent:]
10 0x10ece872d __dispatchPreprocessedEventFromEventQueue
11 0x10ece1463 __handleEventQueue
12 0x10c2a7761 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
13 0x10c28c98c __CFRunLoopDoSources0
14 0x10c28be76 __CFRunLoopRun
15 0x10c28b884 CFRunLoopRunSpecific
16 0x110d3fa6f GSEventRunModal
17 0x10e4ddc68 UIApplicationMain
18 0x10da1197d ffi_call_unix64
19 0x12ce0c2c0
JavaScript stack trace:
1 send@file:///app/tns_modules/nativescript-google-analytics/index.js:96:35
2 logException@file:///app/tns_modules/nativescript-google-analytics/index.js:96:35
3 onTap@file:///app/item/items.component.js:25:37
4 handleEvent_5@:151:39
5 @[native code]
6 @file:///app/tns_modules/nativescript-angular/renderer.js
:213:31
7 invoke@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:190:33
8 onInvoke@file:///app/tns_modules/@angular/core/bundles/core.umd.js:4391:47
9 invoke@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:189:42
10 run@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:83:49
11 zonedCallback@file:///app/tns_modules/nativescript-angular/renderer.js:212:27
12 notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:149:31
13 _emit@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:168:24
14 tap@file:///app/tns_modules/tns-core-modules/ui/button/button.js:21:24
15 UIApplicationMain@[native code]
16 start
@file:///app/tns_modules/tns-core-modules/application/application.js:251:26
17 bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:68:28
18 bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:56:26
19 anonymous@file:///app/main.js:5:57
20 evaluate@[native code]
21 moduleEvaluation@[native code]
22 @[native code]
23 promiseReactionJob@[native code]
JavaScript error:
file:///app/tns_modules/nativescript-google-analytics/index.js:96:35: JS ERROR Error: This value is not a native object.

Sorry - struggling with following the readme

Looking forward to diving into this plugin which looks really great from the docs.

I wonder if you can help me though as I am struggling with the guide. Particularly this bit:

"Click the "Get a Configuration File" instrutctions"

I can't fathom what to do here. Is this a link that should exist in the GA dashboard? I gather I need some files to add to the App_Resources folders?..

confused when doing config app.gradle

Hi everyone,
I'm newbie in nativescript. currently, I want to implement google analytics for my project.
When reading "Get Config files" section, the instructions guide me to access android configuration. right now I've got stuck in adding dependencies, the document in android mention about build.gradle but, like I know, we just add the dependencies in app.gradle.
is there anyone do successfully with this plugin, please guide me.
Thanks

Build failed

Everytime I try to build the application with this plugin, I get this error

Unable to apply changes on device: ZY222W2F3Q. Error is: Failed to build plugin nativescript-google-analytics :
Error: Command failed: gradlew.bat -p <MyPath>\platforms\tempPlugin\nativescript_google_analytics assembleRelease -PcompileSdk=android-27 -PbuildToolsVersion=27.0.3 -PsupportVersion=26.0.0-alpha1

And then this:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
> Could not find support-v4.aar (com.android.support:support-v4:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.aar

I have these SDK.
sdk

And the support library up to date
supportrepo

tns-android: 4.0.1

I have to mention it does run on IOS

Is this plugin supported in AoT (Ahead of time compilation) in {N} + Angular

Hi,

I am experiencing some errors when I am packaging a project for iOS that uses this plugin. I am doing this workflow for bundling the app and I am getting this error once the app is opened:

file:///app/bundle.js:10941:25: JS ERROR TypeError: Attempted to assign to readonly property.
Mar 18 17:54:12 com.apple.CoreSimulator.SimDevice.8A380AE0-BE8A-464E-B1E9-12E1D1F1E55A.launchd_sim[433] (UIKitApplication:com.cobbl.app[0xd1af][5260]): Service exited due to Segmentation fault: 11

This line bundle.js:10941:25 is the bundled code for the initialization of the plugin via the delegate on iOS as described here.

Workaround:
What I ended up doing is to follow this article of extending the UIResponder:

import * as applicationModule from "application";

if (applicationModule.ios) {
    var MyAppDelegate = UIResponder.extend({
            // My custom logic here
            return true;
        }

    }, {
            name: "MyAppDelegate",
            protocols: [UIApplicationDelegate]
        });

    applicationModule.ios.delegate = MyAppDelegate;
}

Add iOS demographics support

App-tracking code change for iOS

// Assumes a tracker has already been initialized with a property ID, otherwise
// getDefaultTracker returns nil.
id tracker = [[GAI sharedInstance] defaultTracker];

// Enable IDFA collection.
tracker.allowIDFACollection = YES;

Segmentation fault on startup

Hi, I have this strange error that seems to happens only when I ran the app in TestFlight (i.e., I was yet unable to reproduce it with tns run ios --bundle - because it is with webpack).

Some ideas ?, seems to be at GA initialization (I manually symbolicate with atos):

{"app_name":"gyntoclient","timestamp":"2016-10-26 15:00:28.77 -0700","app_version":"1.0","slice_uuid":"cda4169d-fa00-399c-9826-6e30712b5f0e","adam_id":0,"build_version":"1.0.17","bundleID":"com.gynto.client","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 10.1 (14B72)","incident_id":"2B57BFB5-AF89-48EF-BD79-FB9C4A33D62C","name":"gyntoclient"}
Incident Identifier: 2B57BFB5-AF89-48EF-BD79-FB9C4A33D62C
CrashReporter Key:   65f1d524233928a536ef8e3ea931340f96a4bae2
Hardware Model:      xxx
Process:             gyntoclient [1043]
Path:                /private/var/containers/Bundle/Application/CBF0A31F-6936-4447-BE6B-1BB5D2AF8EDB/gyntoclient.app/gyntoclient
Identifier:          com.gynto.client
Version:             1.0.17 (1.0)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.gynto.client [600]


Date/Time:           2016-10-26 15:00:28.6969 -0700
Launch Time:         2016-10-26 15:00:24.1013 -0700
OS Version:          iPhone OS 10.1 (14B72)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000000000b0
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
Triggered by Thread:  0

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   NativeScript                    0x0000000100b6277c 0x100b40000 + 141180 +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] (in gyntoclient) + 240
1   NativeScript                    0x0000000100b62a68 0x100b40000 + 141928 +[GAICompressionUtil gai_dataByInflatingData:] (in gyntoclient) + 80
2   NativeScript                    0x0000000100b6bc10 0x100b40000 + 179216 +[FIRAEvent normalizedParametersForParameters:isPublicEvent:] (in gyntoclient) + 620
3   NativeScript                    0x0000000100b6ba4c 0x100b40000 + 178764 +[FIRAEvent normalizedParametersForParameters:isPublicEvent:] (in gyntoclient) + 168
4   NativeScript                    0x0000000100b6c558 0x100b40000 + 181592 -[FIRAEvent initWithOrigin:isPublic:name:timestamp:previousTimestamp:parameters:] (in gyntoclient) + 412
5   NativeScript                    0x0000000100b6c16c 0x100b40000 + 180588 +[FIRAEvent normalizedParametersForParameters:isPublicEvent:] (in gyntoclient) + 1992

crash report

Hi thanks for the good plugin.
Is it possible to setup the logger to catch all unhandled exceptions and to send these ones as a crash report?

Nicky

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.