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

fixes for the closed issues - 593 & 595 #596

Closed andaralex closed 2 years ago

andaralex commented 2 years ago

fixes for the closed issues - 593 (Using multiple trackers in iOS ) & 595 (updated GoogleAnalytics pod spec version to support iOS architecture arm64)

victorsosa commented 2 years ago

593 (Using multiple trackers in iOS ) is just implemented as set a new tracker; but the idea is to have multiple trackers at the same time, don't you agree?

andaralex commented 2 years ago

Correct, it just set the new tracker instance as default tracker.

Yes, in some rare use-cases, developer might needs to use multiple trackers in single application.

Also, by default Google Analytics supports multiple trackers (Ref: https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_with_multiple_trackers), so in some cases developer might expect this feature in our plugin too.

victorsosa commented 2 years ago

could you please update the DOCs: with some javascript example code

andaralex commented 2 years ago

Already I have mentioned the sample code for Ionic Native Usage in commented line. FYI., Working with multiple trackers

            this.ga.startTrackerWithId('YOUR_TRACKER_ID_1')
            .then(() => {
                // Send a screen view to the first property.
                this.ga.trackView('First Tracker');
            })
            .catch(e => console.log('Error starting GoogleAnalytics', e));
            this.ga2.startTrackerWithId('YOUR_TRACKER_ID_2')
            .then(() => {
                // Send another screen view to the second property.
                this.ga2.trackView('Second Tracker');
            })
            .catch(e => console.log('Error starting GoogleAnalytics', e));
victorsosa commented 2 years ago

I meant the readme file

andaralex commented 2 years ago

Updated the readme file and raised PR. Please check. @victorsosa