Tealium Andriod library and tags with cookies

Gold Contributor
Gold Contributor
Dear, We are testing Tealium andriod sdk for our native Xamarin App. We have a custom tag that set a cookie. We notice that on some Android devices this cookie isn't set. I think we can solve it with putting this in our native app: CookieManager.getInstance().setAcceptCookie(true); Any one a better idea? Kind regards T
15 REPLIES 15

Tealium Andriod library and tags with cookies

Employee Emeritus
Thomas Thank you for taking the time to reach out to us. A request has been put in to our Engineering team to see what the best approach is. Please standby for a response.

Tealium Andriod library and tags with cookies

Tealium Employee

Hello Thomas, The method CookieManager.getInstance().setAcceptCookie(true); should suffice. We have read some issues surrounding the timing that method and WebView creation, so we've vended a config option of the same name in the Tealium.Config object of the latest version of the library (https://github.com/Tealium/android-library).

Tealium Andriod library and tags with cookies

Gold Contributor
Gold Contributor

Can you give more info around: We have read some issues surrounding the timing that method and WebView creation, so we've vended a config option of the same name in the Tealium.Config object of the latest version of the library (https://github.com/Tealium/android-library). Indeed we have seen some crashes in the app

Tealium Andriod library and tags with cookies

Tealium Employee

In terms of timing, the library will call CookieManager.getInstance().setAcceptCookie(...) after the WebView creation in light of http://stackoverflow.com/questions/17230757/how-to-enable-cookies-in-android-webview. If you are observing crashes involving the Tealium Library, we invite you to post issues in the GitHub repo or reach out to your account manager to get them resolved. Please be sure to supply steps to replicate and stack traces so we can swiftly resolve your issues.

Tealium Andriod library and tags with cookies

Gold Contributor
Gold Contributor
Chad, Can you not build it into the component and put it as a config setting so that we can also use 3th party cookies in the webview (for this one we need a reference to the inner webview) Kind regards Thomas Annerel

Tealium Andriod library and tags with cookies

Tealium Employee

As of release 4.1.3 (https://github.com/Tealium/android-library/releases/tag/4.1.3) there's a config setting called "setAcceptCookie", but when you say 3rd party cookies are you referring to the Lollipop-introduced "setAcceptThirdPartyCookies" API (http://developer.android.com/reference/android/webkit/CookieManager.html#setAcceptThirdPartyCookies%...)?

Tealium Andriod library and tags with cookies

Gold Contributor
Gold Contributor
Indeed, The problem is that alot of tags still use persistant cookies and third party cookies. I'm even not sure that persistant cookies are kept over app restarts.

Tealium Andriod library and tags with cookies

Bronze Contributor
Bronze Contributor

Did you get any progress on this? I seem to be having the same issue, none of our tags loaded retains cookies which really mess with our external tools depending on it.

Tealium Andriod library and tags with cookies

Moderator
Moderator
Hi @larhan. You need to make sure you have followed this guide to enable cookies on Android: https://community.tealiumiq.com/t5/Mobile-Libraries/Mobile-110-Getting-started-with-Android-amp-Andr...

There is no additional config required on iOS - all cookies are enabled by default.

Let me know if you need further assistance.

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.

Tealium Andriod library and tags with cookies

Bronze Contributor
Bronze Contributor

Thanks Craig,

I did find it. It would have been nice to have as a built-in feature, as I can imagine quite a few might overlook this as part as an implementation. I can hardly find a case where I would intentionally block the cookies from the WebView:)

/Lars

Tealium Andriod library and tags with cookies

Moderator
Moderator
You're right @larhan. I will log this internally and see if it's possible.
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.

Tealium Andriod library and tags with cookies

Bronze Contributor
Bronze Contributor

Do you by any chance have any scenarios where this would not work? I have set up a small demo app and it works just fine, my cookies are persisted and transferred to both Tealium and GA with weeks of inactivity of my app.

However our agency duplicated my code over to our app, but it seems like the internal web view still drops the cookies. I can have the app running open, come back to my device 30 min later and I would receive a new GA cookie.

Both apps has been tested on the same device.

Any ideas are greatly appreciated, even just vague pointes I can take back to the agency:)

 

Thanks

 

/Lars

Tealium Andriod library and tags with cookies

Moderator
Moderator
Hi @larhan,

The only reason this would happen is if they have missed the cookie enablement code when they initialise the Tealium library. If it's not missing, then it hasn't been implemented correctly.

To avoid confusion, we are considering changing the default behaviour back to having cookies enabled by default, as this is the most common scenario. I'm not sure exactly when this will be released, but I expect that it should happen early in the new year.

If the agency can't get it to work, please contact support.emea@tealium.com, and I can set up a call with them to troubleshoot.

Thanks and Merry Christmas,

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.

Tealium Andriod library and tags with cookies

Bronze Contributor
Bronze Contributor

Hi @craig_rouse,
I'm interested in knowing the evolution of this topic over the years ...
I need to preserve the cookie value in the Android system WebView used by TealiumIQ in our app because the cookie changes (not only after killed the app but also while using the app) and I found a recent answer on StackOverflow .com which suggests using "CookieManager.getInstance().Flush()", but I think this change should be done in the Tealium SDK, right?

Thanks
Diego

Tealium Andriod library and tags with cookies

Moderator
Moderator
@romandiego apologies for the delay in replying - I only just saw this. We do indeed call CookieManager.getInstance().flush after each tracking call to make sure the cookies are flushed to disk regularly. If you're having issues, please raise a support ticket, and the support team can help you out.
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.
Public