- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
09-28-2016 08:39 AM
Dears,
I have a strange issue I'm breaking my head on for a while now :
Setting :
Now the problem :
In Audiencestraem I don't see the traffic from the Android and I see the traffic from the iOS app.
Any suggestions?
The differences : Android has SDK5 and iOS has SDK4 for the native traffice, but I'm talking about non-native traffic here.
Thanks for thinking,
Philippe
09-29-2016 02:22 AM
Hello,
Note: I am an employee of the Philippe Vlaemminck (who posted this issue).
We have figured out why the Collect calls were not working. I am posting this here so if people run into this issue before Tealium updates the Collect tag template, they know what's causing it.
Apparently the Collect tag uses the 'localStorage', and because the value of localStorage was null in our browser, the script failed when trying to use it.
In the script is a check to see if localStorage is undefined, like this: if(typeof localStorage != 'undefined' && …. ){…}
But because the value of localStorage is null, the condition passes as true.
I would suggest changing the check to something like if(!localStorage && … ) { … }
This would result in a false if localStorage is either undefined or null. Alternatively just add a check if localStorage === null.
The reason localStorage is null is because when the WebView was initialised, it wasn't explicitly told to enable localStorage.
If we add the following line to the code:
webView.getSettings().setDomStorageEnabled(true);
Then localStorage is enabled and the script works just fine.
Regardless, I believe the template should be updated to take this situation into account.
I am hoping Tealium will update this soon :)
Good luck!
09-29-2016 12:03 PM
Thank you for the answer and feedback @Sam. We appreciate it! I will also forward your suggestion to the appropriate department.
CC: @philippe_vlaemm
09-29-2016 08:06 PM
Hey @Sam and @philippe_vlaemm,
May I ask some clarifying questions so that I can submit this correctly?
I could use some assistance figuring how how this was an issue only on Google (Chrome?) and not on Apple (Safari?). I would seem that if it happened on one browser it would happen on the other. Any insight here?
Is there 1 or are there 2 profiles controlling the in-app browsing? I guess 1 since it's technically just a web page, but want to be sure.
You mentioned you updated the following line of code: typeof localStorage != "undefined". This belongs to the page performance function "u.get_performance_timing". At the top of this function we declare the variable "data" as an object, we then add many key/values to this object, stringify it, then save it in local storage. So at the least, an object should be saved.
Also, the check to see if localStorage!="undefined" would only ever be applicable on the first page view on a new visitor, and even then it would never equal null, it would truly be undefined. Then, after the very first page view the localStorage would be set with an object of data.
So I guess what I'm saying is that I need assistance replicating this issue so we can see how a null value is getting set. Of the many clients using this functionality, this is the first report of it so it seems like a unique issue. Any insight you can provide to help determine how this is occurring would be great.
Is the site loading the app accessible via a URL outside the app? This would be the best method to help us look into this further.
I look forward to the feedback, and please let me know if you have any questions.
Cheers,
-Dan
09-30-2016 12:48 AM
Hi @dan_george,
The issue isn't on Chrome nor Safari. The issue is with the Android WebView for in-app browsing.
To test this we have created a basic Android Application containing a WebView.
This WebView points to a page with Tealium and a Collect tag active in the Tealium profile.
With the default settings of the WebView, the Collect tag does not work, because localStorage was equal to null (not undefined).
This must be something that Android WebViews do (at least on some versions/phones).
When you enable DomStorage in the WebView by calling mWebView.getSettings().setDomStorageEnabled(true);
you enable the use of localStorage within the WebView. When this setting is enabled, the Collect tag works fine.
So by following the next steps, you should be able to replicate the issue:
When launching the app, you should be able to see that the collect tag loads fine, but there is no call being fired to the collect servers, due to an error happening within the collect tag.
Good luck!
09-30-2016 08:16 AM
@Sam thanks for the additional details! My knowledge of the Mobile App is a bit limited so I appreciate all the info profided. We'll attempt to recreate this and follow up with our findings.
09-30-2016 09:53 AM
Hey @Sam
Without the .setDomStorageEnabled enabled, collect will not work.
.setDomStorageEnabled(true) should be enabled to make use of local storage.
When we followed the steps you mentioned AND setDomStorageEnabled(true) we see collect dispatches coming through to AS and no errors in console.
Can you give that a try (with the defaut template) and report back with your results?
10-07-2016 12:03 AM
Hi @dan_george,
As I mentioned in my last reply, I have already tested this scenario.
I have confirmed that it does indeed work when DOM storage is enabled.
But as the template checks for the scenario where localStorage is undefined, it should also check for the scenario where it is null. This because the localStorage is null when DOM storage is disabled.
10-07-2016 08:32 AM
Thank you, @Sam I have opened the required development ticket to get this updated.
Copyright All Rights Reserved © 2008-2023