2.2K members online now
2.2K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Google Analytics for Hybrid Application

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi All,


I have a responsive website, which I've applied Google Analytics, in order to keep track the traffic from web browser or mobile browser.


Recently I've turned this website into a hybrid app by using online app-maker - GoNative.  (This is not a native app, basically it just turn my website into an installable mobile app, but the mobile app won't works without internet connection.)


But here comes the issue that how can I differentiate in Google Analytics that the traffic is come from web browser / mobile browser / Mobile Hybrid App?


In Google Analytics, I can't find the data such as userAgent for further filter (As the app-maker will append their brand in userAgent).


Will be very appreciated if there is any solution on this.


Thanks a lot in advance.




Re: Google Analytics for Hybrid Application

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭
Hi Nga,
Did you find a solution for this? I'm also trying to figure it out for a hybrid app that needs to run in offline mode and want analytics for it.

Re: Google Analytics for Hybrid Application

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Adil K,

Yes, I had.

I'm using PHP.

1. I've created 2 GA account, 1 for my website (desktop browser/mobile browser), 1 for my app.
2. Basically, I will still need to get the user agent from $_SERVER["HTTP_USER_AGENT"]. GoNative has append the word 'gonative' behind the user agent.
3. Once I detect there's 'gonative' in user agent string, i will use GA code for my app, else use the GA code for my web.

So far there is no way to filter the user agent in Google Analytics.

Thus, I've created 2 GA account to track the traffics from different sources.

In case you want a total traffic of your web + mobile browser + hybrid app, (so that you do not need to manual add the data yourself from 2 GA accounts), just create another GA account for main traffic counter. So whenever you send the traffic data to GA:
- For example I have Main GA (00001), Web GA (00002), Hybrid App GA (00003).
- If user browse the website on desktop or phone browser, send the traffic data to Web GA and Main GA.
- If user use the Hybrid app, send the traffic data to Hybrid App GA and Web GA.

You may refer to the Google documentation for more details on how to send the traffic data to 2 GA account:
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', '<? echo $google_analytics_system;?>', 'auto');
ga('create', '<? echo $google_analytics_main;?>', 'auto', {'name': 'TronMainGATracker'});
ga('send', 'pageview');
ga('TronMainGATracker.send', 'pageview');


Hope this will help you?