# Alert if users from other country access application

**URL:** <https://community.dynatrace.com/t/alert-if-users-from-other-country-access-application/42084>\
**Category:** Open Q&A\
**Tags:** real-user-monitoring-classic, problems-classic\
**Created:** [October 13, 2023, 5:59pm UTC](https://community.dynatrace.com/t/alert-if-users-from-other-country-access-application/42084 "2023-10-13T17:59:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![natanael\_mendes](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/natanael_mendes/32/15264_2.png) [@natanael\_mendes](https://community.dynatrace.com/u/natanael_mendes)\
**Post date:** [October 13, 2023, 5:59pm UTC](https://community.dynatrace.com/t/alert-if-users-from-other-country-access-application/42084/1 "2023-10-13T17:59:47Z")

</div>

How to create an alert in this situation?

---

<div class="post-metadata">

**Author:** ![dannemca](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dannemca/32/7215_2.png) [@dannemca](https://community.dynatrace.com/u/dannemca)\
**Post date:** [October 13, 2023, 7:55pm UTC](https://community.dynatrace.com/t/alert-if-users-from-other-country-access-application/42084/2 "2023-10-13T19:55:29Z")

</div>

Assuming you are monitoring your frontend application, you can use a USQL like this: “SELECT count (DISTINCT userSessionId), country FROM usersession GROUP BY country” and then create a custom metric, using the field country as dimension.

With the metric in hand, you can create a metric event whenever the country value is different from the one you need, and value is higher 1, for example.

Let me know if this helps.

---

<div class="post-metadata">

**Author:** ![natanael\_mendes](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/natanael_mendes/32/15264_2.png) [@natanael\_mendes](https://community.dynatrace.com/u/natanael_mendes)\
**Post date:** [October 16, 2023, 7:23pm UTC](https://community.dynatrace.com/t/alert-if-users-from-other-country-access-application/42084/3 "2023-10-16T19:23:53Z")

</div>

thanks for the solution&nbsp;[@dannemca](https://community.dynatrace.com/user/18264)

---

<div class="post-metadata">

**Author:** ![natanael\_mendes](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/natanael_mendes/32/15264_2.png) [@natanael\_mendes](https://community.dynatrace.com/u/natanael_mendes)\
**Post date:** [October 17, 2023, 6:59pm UTC](https://community.dynatrace.com/t/alert-if-users-from-other-country-access-application/42084/4 "2023-10-17T18:59:52Z")

</div>

can you help me with this?
