I recently wrote about Facebook’s in-app browser over on StateOfDigital. In that I encouraged marketers and publishers to stop ignoring what is one of the most popular and under-reported segment of browsers on the web.
Anyone involved in marketing or monetizing a website that gets traffic from Facebook would do well to read this if they are not already familiar with the issues. In short, apps like Facebook often now open links in their own browser window. This isn’t reported by analytics, might render differently and will make a mess of your advertising revenues and cookie use.
In-app browsers, the hidden issue
The first step to dealing with the issue, as ever, is to measure it. This is a challenge as Google Analytics doesn’t properly report on in-app browsers. Looking at Google Analytics might lead you believe that it is only Safari users who use in-app browsers, which is not the case. In-app browsers (accurately called “web view windows”) run as a child of whatever the user’s primary browser is. Safari chooses to report this as ‘Safari (in-app)’ where as other browsers don’t differentiate. A Chrome user viewing your website in-app, for instance, will simply report as using Chrome, even though their experience might be quite different to if they were using the full browser.
Throwing light on the issue
As in-app browsers can have a big impact on ad revenue, this is information that I want to be able to access when working with partners on website monetisation. The first step for me is to plug this gap in Google Analytics. I do this using Custom Dimensions.
Adding a Custom Dimension for in-app browsers
Custom Dimensions are a handy feature of Analytics that are perfect for jobs like this. Adding a custom dimension of in-app browsers will allow us to start tagging up users of any that we are interested in tracking. Here is how:
In Google Analytics
- Switch to the property where the data will be saved
- Click Admin, then select Custom Definitions, then Custom Dimensions
- Create a new custom dimension as shown here
This gives you a way to track the dimension. Take a note of what Dimension number is used when you create this. We now just need to pass the value into Facebook.
On-page changes
In order to pass the value into Google Analytics we need to read the user-agent string and set the custom dimension. This just needs a small snippet added to the Analytics tag:
Assuming you are using GPT tags simply add the following line just before ga(‘send’, ‘pageview’);
var ua = navigator.userAgent || navigator.vendor || window.opera; ga('set', 'dimension1',(ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1) ? 'Facebook' : 'None');
Note, if the in-app dimension isn’t the first that you have created then you may need to change dimension1 to match the dimension number created in analytics earlier.
How to read this
This method allows you to add dimension to show in-app browser use to most reports. For instance, here is a breakdown for traffic referred from Facebook to a test link that I shared.
Having this data available as a dimension allows you to apply it to many report types. You could, for instance, compare bounce rates, visitor loyalty or AdSense/Adx revenue performance.
Taking the idea further
The script snippet provided only detect’s Facebook’s in-app browser, but the logic can be applied to the webview windows opened by other mobile apps. You simply need to find the unique strings reported in their user-agents.
For those involved in ad-serving the same technique can be used to target in-app browsers in DFP, allowing you to measure ad performance and send more targeted impressions to those users. Keep an eye on the blog for exactly how to do that in my next article.
Cam Beck says
How would you implement this through GTM?
Mat Bennett says
This is a very good question. I’ve not done it that way, but I might now. Thanks for the idea! If I do then I’ll post the solution back to the blog.
Josephine Søgaard Andersen says
I’d love to know this as well! :)
David Richarz says
How do you ensure that ga(‘set’, ‘dimension1’,(ua.indexOf(“FBAN”) > -1) || (ua.indexOf(“FBAV”) > -1) ? ‘Facebook’ : ‘None’); is only set when someone follows a link to your website via Facebook’s web-view?
Mat Bennett says
We set the value on every visit, but the value we are setting is whether the user-agent includes the string “FBAN” or not. This is a fairly reliable footprint for the facebook inapp browser.
David Richarz says
Thanks for the reply, Mat! I thought there might be a way to set this dimension only on Visits that really originate from FB’s Webview and use a default ‘None’ value for everything else from GA internally. I have some rather big sites that get frequently visited from Google or via direct and more, where I’d like to use as little code as possible, since there is already a lot of Objects set for GA.
Mat Bennett says
Should be pretty easy just to wrap the whole thing in an if statement that checks for that same string.
Hema says
Informative!! Thanks a lot Mr. Mat Bennett!!
I was in confusion since last 8 months regarding the huge difference in Facebook insights and GA numbers. For now, my research end-up with this article and try the same on my website. Thank again!!
Shehbaz says
Hi,
My total number of sessions from facebook before applying the secondary dimension for a particular date was 164. Once I add a secondary dimension of Facebook In app, it only shows 11 sessions. Facebook-None=7 and Facebook-Facebook=4.
Am I doing anything wrong or is there a different way to read this report?
Please help!
Amy Smith says
Hello!
How do you ensure that your event setup works properly in in-app browsers? Have you ever seen issues where one event will over-fire due to being used in an in-app browser?