Google Analytics
Learn how to segment app users in your Google Analytics account
Track Canvas page views via Google Analytics
You can track your app users via Google Analytics and Google Tag manager.
In order to do this, you will need to create a custom dimension in Google Analytics, and create a new tag that checks the user-agent in Google Tag Manager.
Even though this sounds simple enough, there are quite a few things you need to do on both platforms to achieve the desired result.
If you have a popular website, with many users, we’d recommend asking a developer to help you with this, to avoid issues with your Analytics metrics.
Before we start, keep in mind that MobiLoud Canvas relies on your website for all the content, when a page of your website is displayed in the app, we are simply performing an HTTPS request to it. For that reason, we are going to use the same Google Analytics Property that you use for your website, and it should look like this:
.png?table=block&id=2b8d1f26-d0d9-4ede-be97-d81948d7cb23&cache=v2)
Let’s get started!
Step 1 - Create a custom dimension in Google Analytics
First, go to “Configure” on your left sidebar:
.png?table=block&id=59f232b3-d8da-4c72-bb74-4db6e5bc26e6&cache=v2)
Now select “Custom Definitions”:
.png?table=block&id=1de2eecd-5f3a-4114-b2fc-4f513980cfc5&cache=v2)
Click the “Create custom dimensions” button on the right side of the screen:
.png?table=block&id=14a9a253-e68b-464e-a28b-10b7e934509d&cache=v2)
A form will appear on the right side of your screen, and you must fill the fields as follows:
- Dimension name: app_user
- Scope: User
- Description: can be empty
- Event parameter: app_user
It is extremely important to use the values above, for consistency. Later, once you have a clear understanding of how the setup works, you can adjust it accordingly if you’d like to. Your form should look like this:
.png?table=block&id=16802388-3064-4e52-8931-cf3a6a41e69f&cache=v2)
Step 2 - Copy your Web Steam Measurement ID
Before leaving your Google Analytics Dashboard, go to “Admin” on the left sidebar:
.png?table=block&id=2ed972e3-0707-4623-a349-9c5c08cd37fc&cache=v2)
Select “Data Streams”:
_(1).png?table=block&id=3b3258a0-1056-4bf2-b09e-9f951276f7eb&cache=v2)
Select your website’s data stream:
.png?table=block&id=393ce119-ac6a-4e06-9011-0f9c190a89d9&cache=v2)
Click the “Copy” button on your Measurement ID, and save the number somewhere on your computer, you will need it later:
.png?table=block&id=23c642dd-c27a-4434-8a09-75ae08a0fec5&cache=v2)
Step 3 - Setup your variable in Google Tag Manager
Let’s move to Google Tag Manager now, you can click on your website name in the top left area:
.png?table=block&id=c0ae7a8c-3b0a-4835-a52b-5d91ba421bf3&cache=v2)
On the window that will appear, move to the “Google Tag Manager” icon, and select your website:
.png?table=block&id=6fd3a1c8-e1e7-4421-861c-9324eed3b80e&cache=v2)
You are now in the “Tag Manager” area, click the “Variables” link on the left sidebar:
.png?table=block&id=d8d9ecd4-0adf-41a2-b868-597464dc9f78&cache=v2)
Then click the “New” button on the right side:
.png?table=block&id=1a191610-d5b9-472f-9970-dc673fc00885&cache=v2)
Click on the large block that will appear to start configuring your Variable:
.png?table=block&id=b726eccc-c565-4dee-a2d9-68fdb3dc2a74&cache=v2)
Now pick “Custom Javascript” as the variable type:
.png?table=block&id=131bc90a-cd3a-4aa6-8093-cd4ab3604c43&cache=v2)
You will then be requested to provide a piece of Javascript code, as follows:

Here is the code so you can easily copy and paste it:
function() { var isApp = navigator.userAgent.toLowerCase().indexOf('canvas') > -1; if (isApp) { return "canvas"; } else { return "browser"; } }
Make sure to save your variable:
.png?table=block&id=47498cde-5855-4bc4-bc64-7ab49e6cf813&cache=v2)
Step 4 - Create your tag in Google Tag Manager
With your variable created, it is time to create your tag. Click “Tags” on the left sidebar:
.png?table=block&id=5a705e9c-04d0-49f8-b0c4-995e9d05d647&cache=v2)
Click the “New” button on the right side:
.png?table=block&id=6a694df4-102b-4694-bb61-56446b5de79a&cache=v2)
Click the “Tag configuration” block:
.png?table=block&id=b8cb7cd7-3979-4d4c-8e0d-4a16e22ef01b&cache=v2)
Pick “Google Analytics: GA4 Configuration” as the tag type:
.png?table=block&id=b64d2c9d-4a28-45d3-8142-1efddb9601be&cache=v2)
Fill in the “Measurement ID” field with the value you previously copied from your Google Analytics account:
.png?table=block&id=25b7d0ad-4c63-43ec-bbe1-76eb46dc4db0&cache=v2)
Expand the “User Properties” area and fill the “Property Name” field with “app_user”:
.png?table=block&id=9bef69b8-30c9-4db7-ac90-46620183a2e7&cache=v2)
On the “Value” field, click the small brick icon and pick the variable you created in the previous step:
.png?table=block&id=f44e46a7-a593-494b-b48f-b955198d0006&cache=v2)
.png?table=block&id=112bc131-2f72-4bdb-89ed-0c6fda6f9035&cache=v2)
Now click the “Triggering” block:
.png?table=block&id=8c3f4392-d36b-4543-ba60-4cc7fbf8be5d&cache=v2)
Select “All pages”:
.png?table=block&id=9ea10e3b-17de-4beb-a27e-8b1524022eaf&cache=v2)
Click “Save”:
.png?table=block&id=bdfb4c43-1dbd-43cf-a277-24ddaee321b2&cache=v2)
Step 5 - Submit your tags and install Google Tag Manager on your website
The first step now is to submit everything you created, so it goes live into production, you can do that by clicking the “Submit” button on the right side of the screen:
.png?table=block&id=0dfa88c1-9df0-40da-bfdc-16c4ff615972&cache=v2)
Google will ask you for a few confirmations, but just click the “Publish” button until your changes are submitted.
If you never used Google Tag Manager before, you might need to add its code to your website, you can find all the details on how to implement the code to your website by clicking on your Tag Manager ID, here:
.png?table=block&id=20aa755b-ee30-4dfa-884a-7527975b021c&cache=v2)
Step 6 - Reporting
Congratulations, if you followed all steps until this point, you should now be tracking all users that are viewing your website through the app.
Note that it might take up to 48 hours until you start seeing user data being tracked with the newly created custom dimension, so give it some time before you look into the reports.
To use your newly created custom dimension, go to your Google Analytics Dashboard, then Reports:
.png?table=block&id=dc3f8d1d-1ef5-4181-9617-3608c65b7674&cache=v2)
Select the type of report you want to see, in this case, we are using “Pages and screens”:
.png?table=block&id=b2fa3603-dd1d-4b4a-8211-64aea76d43ec&cache=v2)
On the report parameters, click the small “+” icon:
.png?table=block&id=73d9cbd9-af3d-4d20-86ab-0ae31c597a8f&cache=v2)
Now pick your “app_user” custom dimension to start showing the data:
.png?table=block&id=77a0f550-a3df-46ba-9cff-8057fb0728bc&cache=v2)
You will now see each page/screen view split between the canvas users and browser users:
.png?table=block&id=e1d585a9-6ff7-442b-93ea-7678ce19ca80&cache=v2)