cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PAB
Level: Powered On

Tracking Users Who Open App

Hi

 

Is there a way to track who is using your App or at least opening it? It would be helpful to know how useful it is within your organization and the amount of traffic your app is experiencing on a daily basis.  Let me know if you have any ideas on where to find this information or how to start tracking it using functions.

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
mr-dang
Level 10

Re: Tracking Users Who Open App

Hi @PAB,

Your formula:

 

Collect(Login, {Name: User().FullName},{Email: User().Email}, {Duration: Timer1.Duration})

would result in three different records each with one column filled in:

 

  • one record with name filled in and email and duration blank;
  • a second record with the email, but the name and duration blank;
  • and a third record with the duration, but the name and email blank.

In order to get all 3 pieces of data in one record, you need to keep them between one set of curly brackets:

 

Collect(Login, 
    {Name: User().FullName,
        Email: User().Email,
        Duration: Timer1.Duration/1000}
)

 

I recommend switching from Collect to Patch when you are writing back to a connected datasource:

 

Patch(Login, Defaults(Login),
    {Name: User().FullName,
        Email: User().Email,
        Duration: Timer1.Duration/1000}
)

 

 

Next, you may want to add on more time to an existing record. Use a condition to tell PowerApps to write data to an existing record. It gets more complicated from there, which is why I quit trying to make this feature Smiley Happy

 

Microsoft Employee
@8bitclassroom
4 REPLIES 4
Super User
Super User

Re: Tracking Users Who Open App

Hi

 

You can add a Label and bind it to UserName of the one who sign in to the Apps.

Make the Label Invisible, and you may then add a Timer, with

- OnTimerStart, Save it to a DS.

- At the same time, you may record the timer duration on howl long the user spend by triggering OnTimerEnd 

 

This is possible with some efforts of doing it though I haven't try it.

I used to do it for WHO use the apps, but not the duration (but possible, with Timer)

 

Have a nice day and hope it works.

hpkeong
mr-dang
Level 10

Re: Tracking Users Who Open App

I tried something similar to @hpkeong since I wanted users to have only one instance open.

 

  1. Create a datasource, LoginLog, that logs when someone has opened an app.
  2. If a User has an instance of the app open, a timer's OnTimerEnd property will periodically update a record in LoginLog to suggest that the User is still on.
  3. If the User attempts to open a second instance, a timer's OnTimerEnd action checks a the datasource to see if the User appears in a record in LoginLog. If they are on within a predetermined activity time, lock the second instance. If they have exceeded the predetermined activity time, show a dialog on the first instance and unlock the second instance. 

    You can determine the conditions depending on your need.

The problem I encountered with this approach is that it's only as good as the datasource can be refreshed in the app to bring you the most current information. In other words, one instance of the app must be able to communicate in real-time with any other instance of the app. 

 

Unfortunately in my testing, even though CDS is the fastest connection, Refresh has a noticeable delay of at least 30s that makes real-time detection like this scheme unviable in v2.0.610. I have not yet tested the speed in v2.0.630.

Microsoft Employee
@8bitclassroom
Highlighted
PAB
Level: Powered On

Re: Tracking Users Who Open App

So I have it where I am recording the Name and Email of who uses it to a collection but when I try to add the duration of the timer it does not work.

 

The following is the working collection of Name and Email:

Collect(Login, {Name: User().FullName},{Email: User().Email})

 

The following does not work:

Collect(Login, {Name: User().FullName},{Email: User().Email}, {Duration: Timer1.Duration})

 

 

Any advice on how to fix this and make it collect the duration of the timer as well.

 

Thank you for all your help!

mr-dang
Level 10

Re: Tracking Users Who Open App

Hi @PAB,

Your formula:

 

Collect(Login, {Name: User().FullName},{Email: User().Email}, {Duration: Timer1.Duration})

would result in three different records each with one column filled in:

 

  • one record with name filled in and email and duration blank;
  • a second record with the email, but the name and duration blank;
  • and a third record with the duration, but the name and email blank.

In order to get all 3 pieces of data in one record, you need to keep them between one set of curly brackets:

 

Collect(Login, 
    {Name: User().FullName,
        Email: User().Email,
        Duration: Timer1.Duration/1000}
)

 

I recommend switching from Collect to Patch when you are writing back to a connected datasource:

 

Patch(Login, Defaults(Login),
    {Name: User().FullName,
        Email: User().Email,
        Duration: Timer1.Duration/1000}
)

 

 

Next, you may want to add on more time to an existing record. Use a condition to tell PowerApps to write data to an existing record. It gets more complicated from there, which is why I quit trying to make this feature Smiley Happy

 

Microsoft Employee
@8bitclassroom