cmackay / google-analytics-plugin

Cordova Google Analytics Plugin for Android & iOS
Apache License 2.0
89 stars 43 forks source link

Google Tag Manager Support #31

Closed cmackay closed 9 years ago

cmackay commented 9 years ago

This ticket is for tracking the work for exposing tag manager api features

cmackay commented 9 years ago

Hi @zmagyar,

Hope everything is going well. I made some updates for the tag manager android support and some API changes. For the API I ended up maintaining compatibility with the existing api and putting all the tagmanager features under analytics.tm. Let me know what you think.

Its in the following branch: https://github.com/cmackay/google-analytics-plugin/tree/feature/gtm

Thanks,

-Craig

zmagyar commented 9 years ago

Hi Craig,

I was also waiting for your feedback on the API. :) Keeping the old API gets my vote. I know what a PITA when a plugin API changes (this usually happens when your are just about to release your product :)). I will merge your changes to my fork and will add a few more changes to the iOS version. E.g. I think we should have a function to allow separate log level setting for gtm. I will also review how the remote functions are working although that might wait for the next release.Probably we can have a release soon as there seem to be a demand for GTM.

Cheers, Z

cmackay commented 9 years ago

Hi Zoltan,

Sorry I didn't get more feedback to you sooner. I had family in town last week. Sounds good about having a logging related function. I noticed the in the android api the tagmanager has a method for enabling verbose logging. I am sure the iOS has a similar function. If you have any ideas for those feel free to add them :) Here are some general comments I have had while working on the Android implementation.

Or we can always keep this initial implementation more minimal and go with it roughly as it is now. Let me know what you think.

Thanks,

-Craig

zmagyar commented 9 years ago

Hi,

Probably it is the lack of my git expertise but I can not access the branch URL you provided above. Although I can see the mentioned feature branch. Have you got any idea what's wrong there?

Checking the changes in my git client I have noticed you have reverted the IDFA related changes at commit dcf052f322490f900483ecea425f731a69e92621. Is there any specific reason for that? Is that because App Store submission requires additional confirmation on IDFA usage? If so we would need to find some way to solve. Currently this is the only one GA plugin which supports it and ad attribution is a quite important feature IMO.

I will check the dispatch interval stuff.

I think we should leave the initial release on the level were it is now in terms of functionality. Later on tag and macro callbacks can be added if there is demand for it.

Cheers, Z

cmackay commented 9 years ago

My mistake. I had setup git-flow for the project and in the process unpublished the gtm feature branch. I just republished that branch.

For the IDFA feature, We will need a way to verify that the feature can be implemented in a way that doesn't cause app store submissions to fail since this can be a major headache for users of the plugin. I had looked into seeing if there is a way to conditionally apply plugins libraries in the plugin.xml but I don't think there is. If you have any suggestions on how we can add this back without causing failed app store submissions, I am open to any suggestions you have. I have not found any libraries that support conditionally including pluglin native libraries. I am not sure if maybe cordova hooks could be used to accomplish this or what the recommended approach might be. Let me know if you think of anything.

Sounds good about keeping this initial gtm release to a limited set of tag manager functionality. Let me know any additional comments or ideas you have.

Thanks!

-Craig

zmagyar commented 9 years ago

Thanks, now can see the branch.

WRT IDFA I have commented the issue. I think it is just down to the lack of information on IDFA. Apps can be nicely submitted with that functionality. You only need to be aware of that and do the submission on that way. You are correct there is no simple way to make this conditionally added via plugin.xml. Therefore I can see only two ways to solve it. You can either

Lets go with the current version then and see how does it pick up. Once it is out and I can start using then certainly our marketing dept will come up with ideas what else do they need from GTM :)

Cheers, Z

cmackay commented 9 years ago

Good suggestions. Since there have been a couple people who have logged issues related to failed app store submissions in the past because of idfa issues, I want to make sure that it is obvious if there are any additional steps users have to take when submitting.

Another possible option is if we create another repository called google-analytics-idfa-plugin. This repository can then depend on the main plugin and can add the additional native libraries, it can then clobber the analytics namespace used by the other plugin adding the additional functions for IDFA support. Since plugins can depend on other plugins this approach should work and it would keep only the necessary idfa functionality in the new repo while utilizing the main plugin for the majority of features. This is just another idea I was thinking of. Some of the mobile chrome app plugins use plugin dependencies as in the example below:

https://github.com/MobileChromeApps/mobile-chrome-apps/blob/master/chrome-cordova/plugins/chrome.identity/plugin.xml

Some other related idfa info: https://code.google.com/p/analytics-issues/issues/detail?id=387 http://techcrunch.com/2014/02/03/apples-latest-crackdown-apps-pulling-the-advertising-identifier-but-not-showing-ads-are-being-rejected-from-app-store/

I am kind of favoring the approach of creating a new repo which adds this functionality to the current plugin to make the submission process easier for the majority of users. That way users requiring this functionality can just install:

cordova plugin add com.cmackay.plugins.googleanalyticsidfa

Just a thought. Let me know what you think.

Thanks!

-Craig

jonystorm commented 9 years ago

Hi @cmackay I was looking for a plugin that allows me to use GTM on my cordova app, does this plugin support it yet? In that case, how can I use it for it? Does it support GTM V2?

Thanks

-Jonatan

cmackay commented 9 years ago

Hi Jonatan,

There was work started to integrate with the google tag manager in the branch (feature/gtm). I haven't looked at it in a long time and I was going to close this ticket since I haven't dedicated time to it recently. I would welcome any contribution if you wanted to help out on it. I forget what the state of the branch is. I guess part of the reason I have not dedicated much time towards the integration is that I haven't had a direct need for the tag manager and I haven't heard many requests for having it integrated. But since you are also mentioning it, I may try to take another look at it and see what needs to be finished up. But feel free to provide any ideas you have for specific features you are looking for.

Thanks,

-Craig

jonystorm commented 9 years ago

I've been looking for a plugin that allows me track events using GTM V2 on Android and iOS. I haven't found one that works properly yet, and I found yours but didn't know in which state it was. I need to be able to track and dispatch events on demand, as with any GA, but through GTM.

Thanks,

-Jonatan

zmagyar commented 9 years ago

Actually I'm working on this again as now came the time when we really need this. The iOS version on the current branch is not working due to some recent SDK function rename. I have fixed that in my fork and added a few more improvements.

There are a few more fixes I'm considering and once those are passed I will make a pull request here.

cmackay commented 9 years ago

Hi Zoltan,

Thats great. I appreciate your help with this. Once you have a pull request, I will review the Android work I had done and see what updates are needed for that.

Thanks!

-Craig

cmackay commented 9 years ago

I don't think this is going to happen anytime soon. Maybe if in the future I have time or a need for this, I will look into it more. Its not only the time required in implementing this feature but also the time it takes to provide ongoing support of it. I welcome pull request if others want to add this. The pull requests will have to be consistent with the current code and ready for use by users. Also it appears there is no direct dependency between the tag manager and analytics library so this code could be a completely separate plugin. If you want to take what is in the branch and clean it up and get it to a separate project that might be a good option. I might look into this more at a later date but until then I am marking this wontfix.