Google Analytics hybrid app

Gold Contributor
Gold Contributor

We have an app with native implementation and webview. I'm using uid parameter and passing the same value in datalayer for both parts, to get a single user but I get two different sessions for the same user across the same app session. I 've found a SiteCatalyst solution in the community but it doesnt work for GA.

It seems the problem comes because cid parameter client ID is different between native and webview requests. Any idea to solve this?

Thanks in advance

Best Regards

 

 

14 REPLIES 14

Google Analytics hybrid app

Moderator
Moderator
Hi @ofernandezg

There is a solution to this problem - you need to pass the session ID through from the native side to the webview. Can you first confirm if you have implemented Google Analytics using the Google SDK, or through the Tealium SDK?

Thanks,

Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Google Analytics hybrid app

Gold Contributor
Gold Contributor

Hi Craig

We are using 5.0.4 Tealium SDK, How can I pass the session id in GA? sesion id is equivalent to cid parameter? I don't find any mapping to do this or method

Thanks in advance

 

 

Google Analytics hybrid app

Moderator
Moderator
@ofernandezg

Just to confirm, you would want to grab the session ID from the Tealium GA instance, and pass this through to your web view in GA?

Are you also using Tealium IQ to serve GA inside your webview, or is this managed outside of Tealium? Sorry for all the questions!

Thanks,

Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Google Analytics hybrid app

Gold Contributor
Gold Contributor

Just to confirm, you would want to grab the session ID from the Tealium GA instance, and pass this through to your web view in GA?

Yes I want to pass the session ID from native to webview part, we need to have all screens under the same session in GA


Are you also using Tealium IQ to serve GA inside your webview, or is this managed outside of Tealium? Sorry for all the questions!

Yes i'm using the same profile to track webview

Thanks in advance

Google Analytics hybrid app

Moderator
Moderator
@ofernandezg Just letting you know I haven't forgotten about you, but the answer is quite complex, and I want to make sure it's correct.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Google Analytics hybrid app

Gold Contributor
Gold Contributor

Thanks @craig_rouse I look forward to hearing from you

Google Analytics hybrid app

Gold Contributor
Gold Contributor

@craig_rouse Please do you have any news about this subject?

Google Analytics hybrid app

Moderator
Moderator
Hi @ofernandzeg

Sorry it has taken so long to finish this; we have just published the article today. As you will see, it is quite detailed, and we wanted to make sure it was absolutely right before releasing it. Please see here for details:

https://community.tealiumiq.com/t5/Mobile-Libraries/How-to-sync-analytics-sessions-in-hybrid-apps/ta...

Let me know if you have any questions.

Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Google Analytics hybrid app

Gold Contributor
Gold Contributor

Thanks @craig_rouse

I'm Sorry for a such delay, we have tested the sample app, but onInvoke callback function never is called, can you help us?

@Override
protected void onInvoke(Response response) throws Exception {
JSONObject resp = response.getRequestPayload();
GAApplication.gaSessionId = resp.optString("sessionId", null);
}

Regarding the GA custom template, when will be published a new version with clientId mapping?

Thanks in advance

Oscar

Google Analytics hybrid app

Moderator
Moderator

Hi @ofernandezg,

Sorry for the delay here too. Have you updated the profile reference in the sample app to your own profile, or kept the default, which is pointing to my test account/profile?

I have just re-tested the sample app using my test account/profile, and it works fine. If you've changed the profile, ensure you've added all the relevant extensions described in the article, and that you've added the TagBridge tag, along with the correct command ID (syncSessionId in this case)

Let me know if you get it working.

Craig.

Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Google Analytics hybrid app

Gold Contributor
Gold Contributor

Hi @craig_rouse

I'm using your test profile inside the attached android sample app, the function onInvoke never is raised and therefore the client id is assigned null value.

Thanks in advance

Óscar

 

 

Google Analytics hybrid app

Moderator
Moderator
Hmm.. that's strange @ofernandezg - I just downloaded, recompiled and ran the app, and the onInvoke method got called immediately. Maybe it's worth deleting your downloaded version and downloading and running again. If it's still not working, it would be useful to know more about your environment (what Android version you are using, physical device/emulator, Android studio version etc.).

If you are setting breakpoints in the code in Android studio, be sure to run the app in debug mode, otherwise your breakpoints won't activate. You probably already knew this, but I thought it was worth mentioning.

Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Google Analytics hybrid app

Moderator
Moderator
Hi @ofernandezg

Just circling back to let you know that the update to the GUA template to support clientId mapping is now complete, and the custom template is no longer required. You can safely revert back to the standard template, and the clientId mapping you already have set up will continue to work as expected. Obviously testing is recommended before releasing to production, but there shouldn't be any issues.

Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Google Analytics hybrid app

Gold Contributor
Gold Contributor
Hi Craig

Thank you for telling us about this new feature, we are going to test the new template as you said

Best Regards
Public