danwilson / google-analytics-plugin

Cordova (PhoneGap) Plugin to connect to the native Google's Universal Analytics SDK 3.0
MIT License
693 stars 500 forks source link

I can't see the analytics #574

Open AhmedSamir848 opened 4 years ago

AhmedSamir848 commented 4 years ago

i included the plugin inside my project and it's cordova based to i'm using the normal JS code . it's the code i used inside onDeviceReady function ` window.ga.startTrackerWithId('PROPERTY ID', 30, success = () => { console.log('Google analytics is ready now');

  //the component is ready and you can call any method here
  //To track a Screen (PageView):
  window.ga.debugMode();
  window.ga.setAllowIDFACollection(true);
  window.ga.trackView('home');
  window.ga.trackEvent('Category', 'Action', 'Label', 1)// Label and Value are optional, Value is 
  numeric      

}, error = e => console.log('Error starting GoogleAnalytics', e)); `

and this code prints "Google analytics is ready now" but i can't see the analytics through the web , the number of USERS IN LAST 30 MINUTES doesn't change or any other analytics . could you help plz ? thnx

bots-business commented 4 years ago

Seems this plugin s deprecated https://github.com/danwilson/google-analytics-plugin/issues/556

I had worked plugin before. But now it is not works too.

teslavitas commented 3 years ago

I have the same issue. It work on browser platform, but doesn't work on Android.

malwatte commented 3 years ago

You need to switch to the Google Analytics JS library. change the GA project to a web project. It works fine for me. Firebase Analytics does not have most of the stuff I need.

nicholasstephan commented 3 years ago

@malwatte What JS library do you mean? Just including the standard analytics snippet in my index.html and pushing pageviews like a website doesn't seem to do anything when running on mobile.

malwatte commented 3 years ago

@nicholasstephan I created a new property in Google Analytics (web site). Then added the script in index.html.

There are multiple environemts in the app and the GA tracking ID is different. So I initialize the tracker in my code. I use user ID too.

window.ga('create', trackingId, {
      'storage': 'none',
      'userId': userId
});

then window.ga('set', 'checkProtocolTask', () => { });

then

window.ga('set', 'page', pageUrl);
window.ga('set', 'title', title);
window.ga('send', 'pageview');

It works for me.

I have <access origin="https://*.google-analytics.com/*" subdomains="true" /> in config.xml

Turtleted21 commented 2 years ago

@malwatte Hi, Is it this script you add to index.html?

 // Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
  const firebaseConfig = {
            apiKey: "AIzaSyDTWGLBBusvBdss-............,
            authDomain: "test-web-app-84986.firebaseapp.com",
            projectId: "test-web-app-84986",
            storageBucket: "test-web-app-84986.appspot.com",
            messagingSenderId: "771082431820",
            appId: "1:771082431820:web:23256...............",
            measurementId: "G-0CVDSSCDXN"
          };