-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using web site data tracker for mobile app #566
Comments
Hi, Mainly because google no longer supports the Google Analytics Services SDK's after October 2019, more info here https://support.google.com/firebase/answer/9167112?hl=en When you use this plugin, you can set up your property as an app in Google Analytics. Instead you can track your cordova app just like a website, without the need for this plugin. Alternatively you can make use of the Firebase SDK, this way you can set up your property as an app (like recommended by Google).
Kind regards, |
Hi there, @victorsosa so unfortunately this plugin has become obsolete, right? |
For sometime the GA still be supporting this api; except that there is no more SDK development of the API. |
Well I understand that there is not much interest to show how we can continue using the plugin. Anyway, thank you for keeping the project alive. Cheers. |
Hello @MichielJ87
Really? Is it simple as this? Could you give us more details about how to make this works? I would like to use Google Analytics in my Cordova app. Informations found about it after doing researches are a bit blurry to me for now (SDK deprecated, Firebase, etc.). So if finally we don't need plugin at all this would be really simple to integrate. On my Google Analytics account, I have created a new test account to try to track my Cordova App. Then I put the tracking code given by GA into my index.html file (just after the head tag). <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXXX-X');
</script> When I run my Cordova app on my local devices (iOS and Android) nothing happen on the "Real time" tab on my GA dashboard. So I tried to include the tracking code on a test.html file on one of my server and the "Real time" tab on GA increased to 1 user immediately. So the tracking code works. So I'm curious about how you do to get a "website tracking code" working in your Cordova apps... Any advises? Thanks! |
Hi @Faksprod ` <script>
</script>` Other tips that I have are:
Kind regards, |
Hello @MichielJ87 and thanks for your quick reply. I will try your solution and compare it with the one I found this night (which worked well). Solution found from this blog (French) works using an alternative method. If you think your method is better for some reasons feel free to tell me. How to use Google Analytics in a Cordova without any plugin: 1 - Create a new account to get a tracking code on Google Analytics (just like you would do for a website tracking code, not for a mobile app) 2 - Download the Analytics.js script from Google (doc) 3 - Include the Analytics.js file to your project into a classic JS script tag. BUT FIRST, you have to find and comment the following line in the Analytics.js file. if("http:"!=a&&"https:"!=a)throw"abort"; 4 - Wait for the DeviceReady event and create your GA tracking object. ga('create', 'UA-XXXXXX-XX', {
'storage': 'none',
'clientId':device.uuid
}); 5 - Then you can send any informations you want to GA to track your app. ga('set', {
'appName': 'myAppName',
'appId': 'myAppId',
'appVersion': '1.0',
'appInstallerId': 'myInstallerId'
}); 6 - Also you can send Events to GA. ga('send', 'screenview', {'screenName': 'Home'});
ga('send', 'event', 'video', 'started'); Hope this can help someone else! |
Why is this plugin forcing people to create a web site data property to get a tracking number when cordova is supposed to be generating mobile apps and not responsive web sites?
The text was updated successfully, but these errors were encountered: