# Tracking access by users

**URL:** <https://forums.knack.com/t/tracking-access-by-users/12368>\
**Category:** Get Answers\
**Created:** [April 9, 2022, 7:49pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368 "2022-04-09T19:49:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![WilliamPorter](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/williamporter/32/1354_2.png) [@WilliamPorter](https://forums.knack.com/u/WilliamPorter)\
**Post date:** [April 9, 2022, 7:49pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/1 "2022-04-09T19:49:21Z")

</div>

In the FileMaker apps I’ve been building for years, I always include a table (usually called something like Accesses) that logs every user access to the database. So I know

- who logged in
- when
- from what IP address
- what OS they’re using

This has at least two uses: It might help an investigator if there were a criminal breach of the app. (Touch wood: that’s never happened.) The other use that I make of this table on a fairly regular basis is checking to see how much the app is being used, and by whom.

**Is it possible to get this info in Knack?**

And almost equally important, **is it possible to get this info without having to create a record for every access?** In FileMaker I have no record limits. (There are other limits to worry about.) But of course in Knack I don’t want to proliferate records recklessly.

One thought that occurred to me is that I could perhaps use Make or Zapier to create a record in Airtable each time a user logs in. Is that possible? Is there a smarter way?

---

<div class="post-metadata">

**Author:** ![CarlHolmes](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/carlholmes/32/2814_2.png) [@CarlHolmes](https://forums.knack.com/u/CarlHolmes)\
**Post date:** [April 9, 2022, 8:42pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/2 "2022-04-09T20:42:21Z")

</div>

Not a Knack feature, possible with code 👨‍💻

> **[How can I track what users are doing in my app?](https://learn.knack.com/article/x81n00bhnk-how-can-i-track-what-users-are-doing-in-my-app)**
>
> If you're looking for information on: Who is logging into your app. When they are logging in. What pages they are viewing. What they are searching for. Or what they are downloading. Right now there i…

---

<div class="post-metadata">

**Author:** ![WilliamPorter](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/williamporter/32/1354_2.png) [@WilliamPorter](https://forums.knack.com/u/WilliamPorter)\
**Post date:** [April 9, 2022, 9:07pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/3 "2022-04-09T21:07:49Z")

</div>

Thanks for quick reply, Carl. Didn’t expect to get a response on a Saturday (and evening where you are, too).

~~Do you think it could be done with Zapier or Make? I haven’t started to play with integrations yet and I’m not sure how you’d trigger something like this. May put this off until later.~~ NEVER MIND. Looked at the Zapier/Knack integration options and this doesn’t look promising. Will worry about this later.

(Incidentally, it’s not a built-in FileMaker feature either. Just something that is possible with some scripting.)

---

<div class="post-metadata">

**Author:** ![CarlHolmes](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/carlholmes/32/2814_2.png) [@CarlHolmes](https://forums.knack.com/u/CarlHolmes)\
**Post date:** [April 9, 2022, 9:34pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/4 "2022-04-09T21:34:54Z")

</div>

I use Integromat (Make) quite a bit so think I’m right stating that, even if you can capture the login event data, you’d still have to create a record in Knack. You’d then need to connect to Makes webhook to start the scenario to push it into another service like Airtable or Google sheets etc

You could then circle back and delete the Knack record. However, I’m not sure how you could capture the event of a user logging into the live app. Certainly not a no code solution that I’m aware of.

I’m sure someone can code it, just not me 😆

PS…yes, on the forum Saturday evening at 10:30pm U.K. 🤷‍♂️ - I need to get out more!

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [April 10, 2022, 6:34am UTC](https://forums.knack.com/t/tracking-access-by-users/12368/5 "2022-04-10T06:34:22Z")

</div>

Possible using only JavaScript I think. But records history is available. Also maybe knack also saving that somewhere.

Regards,  
Sunny Singla

---

<div class="post-metadata">

**Author:** ![WilliamPorter](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/williamporter/32/1354_2.png) [@WilliamPorter](https://forums.knack.com/u/WilliamPorter)\
**Post date:** [April 10, 2022, 4:11pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/6 "2022-04-10T16:11:48Z")

</div>

Thanks, Sunny. Not an urgent issue for me now but might become one and I already had it in back of my mind to contact you and ask about possibility of doing this with JavaScript. I guess what I’d want to do is create a record in Airtable or GoogleSheets for each login. But I’ll worry about it later.

Must say I’m a _little_ disappointed this isn’t built-in. It is with Tadabase (not by default, but as an option). And at least for some of the apps I’ve built in the past it’s pretty useful.

Anyway thanks for confirming that there may yet be a solution here.

---

<div class="post-metadata">

**Author:** ![John\_Prescriptive.Solutions](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/john_prescriptive.solutions/32/1420_2.png) [@John\_Prescriptive.Solutions](https://forums.knack.com/u/John_Prescriptive.Solutions)\
**Post date:** [April 18, 2022, 7:11pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/7 "2022-04-18T19:11:11Z")

</div>

I set up something with code that I found a long time ago and have since forgotten where I found it. I did find this which looks very similar to the code I’m using. (I’m not a coder so there is probably a developer somewhere shaking his head at that comment). This looks more simplistic than what you’re looking for but might be helpful.

> **[Last Login and Logout (Object Based)](https://www.soluntech.com/blog/last-login-and-logout-object-based)**
>
> In this entry we show a practical example on how to accomplish this in knack. We list a series of steps that will serve as a guide for the implementation of these logs.

---

<div class="post-metadata">

**Author:** ![WilliamPorter](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/williamporter/32/1354_2.png) [@WilliamPorter](https://forums.knack.com/u/WilliamPorter)\
**Post date:** [April 18, 2022, 7:25pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/8 "2022-04-18T19:25:17Z")

</div>

THANK YOU John. Those instructions look like I can follow them. I’m going to give this a try and will report back. Thanks for the link.

(fingers crossed…)

---

<div class="post-metadata">

**Author:** ![JulianKirkness](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/juliankirkness/32/770_2.png) [@JulianKirkness](https://forums.knack.com/u/JulianKirkness)\
**Post date:** [April 18, 2022, 7:28pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/9 "2022-04-18T19:28:33Z")

</div>

I wrote a blog post about this a while ago which should give you a solution (which you can build on)…

> **[Adding an Audit Trail to a Knack App](https://www.onlinedatabase.expert/post/adding-an-audit-trail-to-a-knack-app)**
>
> I have been asked several times about logging activity and data changes within Knack applications and decided, after another prompt, to look into this and attempt to create something useful which I could share with the community and potentially apply...

Hope this is useful.

---

<div class="post-metadata">

**Author:** ![WilliamPorter](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/williamporter/32/1354_2.png) [@WilliamPorter](https://forums.knack.com/u/WilliamPorter)\
**Post date:** [April 18, 2022, 8:11pm UTC](https://forums.knack.com/t/tracking-access-by-users/12368/10 "2022-04-18T20:11:41Z")

</div>

Thanks for that link, too, Julian.

I took the code from your earlier link, updated it for my app (app ID, api key, object and field ids). Read it through carefully and it LOOKS all right. Pasted into the app where you said to put it, saved, refreshed the page. Then logged into the app and out. Have done this a number of times. No records are getting created in the log object.

Not sure what I’m doing wrong. Do I need to have an actual PAGE created for this object?

I see this is going to create records and I’m not excited about that but I can manage that if I can just get a preliminary record of who gets in and when.

BTW I noticed, in a response to your blog post (second link) that a user named Tony mentioned using transparent pixels to log users. I wonder how THAT would work. Been a very long time since I’ve heard anybody _mention_ transparent pixels. 🙂

---

<div class="post-metadata">

**Author:** ![JulianKirkness](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/juliankirkness/32/770_2.png) [@JulianKirkness](https://forums.knack.com/u/JulianKirkness)\
**Post date:** [April 19, 2022, 8:37am UTC](https://forums.knack.com/t/tracking-access-by-users/12368/11 "2022-04-19T08:37:47Z")

</div>

Hi

I don’t know anything about transparent pixels I’m afraid…

To make the code work, you will need a page to use to input the audit trail data because the code uses view based js. Setting this up is covered in the section “ **Create a Page to view Log records with an Add Option** ” in the article.

I hope this helps - if not, post your code here and I will have a look.
