Deep Dive: Click-Through PowerApps Analytics
Introduction
This blog post will walk through a simple approach to create your own click-through analytics. Extend your reporting options to include statistics which will raise visibility into how your app consumers navigate your applications, enabling you to use data to validate assumptions on app usage and design.
I have attached the MSAPP files and the datasource sample(excel spreadsheet) so you can play around with the app to understand it better and then implement the same approach in your apps.
Workflow overview -
To explore the app, follow these steps -
Step 1: Install the app from the MSAPP file that I have attached below.
Step 2: Save the excel spreadsheet "AnalyticsDemo.xlsx" in your OneDrive and add it as a data source in the app using the OneDrive connector.
Step 3: After saving and publishing the app, open the app and click on some icons and navigate around the app. Check whether the data gets collected in the Excel Spreadsheet. (Note: Sometimes it may take a few seconds before the data gets updated so you might have to close and open the spreadsheet once)
Step 4: Use the OneDrive excel spreadsheet as a data source in a PowerBI report and create different graphs/statistics based on what you would like to measure. Below is an example to get you started -
Capturing Interaction points-
The main functions that I have used to capture the user interaction are the Patch and Collect functions.
To start with, you would probably like to collect some basic user information before you capture any further interaction points of that user. To do this, I used the below formula in the OnStart property of the app-
Collect(AnalyticsDemo,{UserName:Office365Users.MyProfile().DisplayName,UserEmail:Office365Users.MyProfile().Mail,LoginDate:Today(),LoginTime:Text( Now(), "[$-en-US]hh:mm:ss" ),Latitude:Location.Latitude,Longitude:Location.Longitude})
This will create a new record in the Excel data source and because we are using the OnStart property, the basic user information will get collected only once, i.e., when the app is opened by the user. For capturing user details, I have used the Office365users connector.
For any further interaction points / clicks , I used the Patch function to update data in the record that was created above. Below is an example of the Patch function used in the OnVisible property of the Products screen -
Patch(AnalyticsDemo,Last(AnalyticsDemo),{ProductScreen:"Y"})
where
- AnalyticsDemo is the excel data source
- Last(AnalyticsDemo) is the last record created in the data source ( which will be the one that was created on the OnStart property)
- ProductScreen: "Y" updates the ProductScreen column of the data source, which tells you that the Products screen was opened by the user.
This way you can capture any interaction point by using the Patch function as mentioned above in either the OnSelect property of different controls or OnVisible property of different screens and updating a column field in the data source accordingly.
Main takeways from implementing Custom Click-through Analytics -
- Track business/team goals and app usage
- Identify potential app capabilities that need to be modified/upgraded
- Generate reports to emphasize the impact of PowerApps (esp. for your organization's leadership)
For more details, have a look at this webinar where I and @Audrie-MSFT talk about it in detail -
Thanks for reading!
Vivek
Comments
-
Deep Dive: Click-Through PowerApps Analytics
So that's a bit of a "game-changer"... When you realize that using PowerApps with a file in OneDrive or SharePoint or a SharePoint list means that your end users can access the files or list and just do whatever they want with the data. It's hilarious when you consider that many of the demos of PowerApps show how you can restrict data access through the PowerApp depending on the user, or prevent editing certain fields - Yet they don't point out that the user can just find the file in Delve and delete it, or do whatever they want with it. LOL
What "back end" should "Citizen Developers" be using when we want to make a "real app" with secure data? Azure SQL?
-
Deep Dive: Click-Through PowerApps Analytics
@Audrie-MSFT- Wondering if you can answer one of my original questions (posted above... a while back):
Since you have to share the OneDrive folder with anyone you are collecting usage data from would they be able to see the actual Excel file (which you must also share with them) that collects the data if they look you up on Delve?
-
Deep Dive: Click-Through PowerApps Analytics
@Anonymous You are correct, there is currently no easy way to impersonate another users permissions via PowerApps at this time. However, if you can trigger a Flow at the list level, then individual actions from within the workflow can run under a separate user account - other than the creator/modifier of the record.
Thank you,
Audrie
-
Deep Dive: Click-Through PowerApps Analytics
Great integration @ThatAPIGuy! Thanks for the demo.
I agree with @CP153319, these permission settings really aren't optimal yet with PowerApps and Sharepoint. There should be a functionality which allows the app to write data (as a user sort of) somewhere without the actual user having access to that database. @Audrie-MSFT any news on that? It will never be approved by Leadership otherwise. -
Deep Dive: Click-Through PowerApps Analytics
@Anonymous - I have thousands of potentional users for one of my apps so I can't use this particular method. I wonder if there is a way to collect this usage data and store it without having the end user involved in the permissions. There is probably some method you could use with PowerApps and Flow where you could get the data, store it somewhere and then automatically move it somewhere else
-
Deep Dive: Click-Through PowerApps Analytics
I added this code to one of my existing apps and when one of my test users launched it he was prompted to give permisson to the OneDrive connector and then the app failed. It turns out that you must share the data source where you are keeping all this "analytical" data so keep that in mind.
You could use a SharePoint list but then I believe an end user could find that list (they have to have permission to access it) if they are knowledgable about SharePoint.
If you use OneDrive to host the Excel file which holds the data then any user you share it with who looks you up on Delve will be able to see and access the Excel file as well. Is that correct?
-
Deep Dive: Click-Through PowerApps Analytics
Thanks for sharing!
How would you do to implement Audit Trail eg. add User Action(edit, new, delete, print), OldValue and NewValue in a separate "Audit Trail" table? Something like this:
ID | DATETIME | USERNAME | FORMNAME | ACTION | FIELDNAME | OLDVALUE | NEWVALUE |
Old values must not be overwritten and I am kind of a stuck there because "patch" overwrites old values
*This post is locked for comments