2 min read
Filtering app traffic from website Google Analytics
Most poq apps use a web checkout which means that the transactions occur on your ecommerce website and are therefore subject to web tracking. To avoid skewed reporting for the website, the app transactions should be filtered out.
From the website’s perspective, these sessions land on the checkout which gives them an unnaturally high conversion rate. Therefore the inclusion of app transactions in the website analytics skews web reporting. To avoid this, the main view should not report app transactions. This is best achieved by filtering out the app traffic at the view level. This is preferable as it allows for a view that includes both app and web transactions which gives you more options and redundancy in reporting.
There are other options to exclude app traffic from the website GA that we would like to raise. If you are using GTM to power your website’s GA property, then you could set tags not to trigger if the website is within the app’s webview. If you are using scripts on the website to power your website’s GA property, then you could stop the script from running if the website is within the app’s webview.
The identification method for the app that we recommend is to use the user agent. The app has a very distinct user agent which we can use regular expressions to identify.
Adding a custom dimension via GTM
GTM can be used to pull in this additional dimension as the user agent will likely be a parameter that is used for various things on the website front end. You can connect GTM to this parameter to make it available in GTM.
We then want to add it as a custom dimension that gets sent with every hit that goes to the website’s GA property.
Setting up filters and segments in Google Analytics
With user agent now available as a dimension in Google Analytics, we can now set up a filter on the required views.
We recommend that you duplicate your main view. This is typically called “Main”; “Filtered” or reference the brand or website. One copy of the main view will be left with its existing filters: this will be the one that includes app traffic and should be denoted as such. “Main (App Checkout Included)” or “Filtered (App Checkout Included)” would be suitable names. We can then apply a filter for the app to the main view and leave this name unchanged.
- The filter can be added in Admin/View/Filters.
- Then click on the “+ ADD FILTER” button.
- We suggest Exclude App User Agent as a filter name.
- Change the filter type to “Custom.”
- Select the user agent field from the filter field selector under exclude.
- For the filter pattern we will input the key identifying string from the app’s user agent. You’ll need to ask the delivery team what the user agent will be.
- Save the filter.
- Navigate to the view that doesn’t have the app filter [Main (App Checkout Included)].
- The segments can be set up from any screen that shows the “+ Add Segment” option at the top. We recommend Audience/Overview for ease of navigation.
- Click on “+Add Segment” and then “+ NEW SEGMENT.”
- Under “Advanced,” click on “Conditions.”
- Leave the filter as sessions and include.
- Select the user agent field from the drop down. This is likely to say a different field, such as “Ad Content”, initially.
- Change the second drop down from “contains” to “matches regex.” We use this as regular expressions are well defined across tools.
- For the filter pattern we will input the key identifying string from the app’s user agent. You’ll need to ask the delivery team what the user agent will be. Make sure that this is correctly formatted.
- Save the segment