Skip to main content
jvdc
Expert ⭐️
May 20, 2026 12:38 PM UTC

Is there a generic url for the logged in user profile?

I would like to include into some coms a link to the profile of users, not the settings page, the main profile page where we can see the badges etc...

13 replies

Mithila Jayalath
Helper ⭐️⭐️
May 20, 2026 12:44 PM UTC

​@jvdc can you give more context on our usecase?

Translate
jvdc
jvdcAuthor
Expert ⭐️
May 20, 2026 12:49 PM UTC

I want to include in communications, for example when a badge get awarded user are receiving an email notification, I would like to add a button/link “View badge on your profile”

Translate
DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
May 20, 2026 12:55 PM UTC

community.{your-domain}.com/members/user-{userId}

The only things that matter after /members/ are the hyphen and the userId. You could put any text there or just a single character. The userID actually routes the link; it’s how links still work even if a username change. (Same thing for post links where the title / category changes)

Translate
FYI: I am no longer active in this community
jvdc
jvdcAuthor
Expert ⭐️
May 20, 2026 12:56 PM UTC

but I understand {userId} isn't an accepted variable, is it?

Translate
DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
May 20, 2026 12:58 PM UTC

Good call out; I didn’t connect the dots with your requirement. 

I”m not sure if it’s an available variable in system items. 

Translate
FYI: I am no longer active in this community
Mithila Jayalath
Helper ⭐️⭐️
May 20, 2026 2:12 PM UTC

​@jvdc how do you trigger the email when you award the badge?

Translate
jvdc
jvdcAuthor
Expert ⭐️
May 20, 2026 2:14 PM UTC

It's just the email that comes with the badge settings

 

Translate
Mithila Jayalath
Helper ⭐️⭐️
May 20, 2026 9:35 PM UTC

​@jvdc Natively, there is no direct way to link to a user profile from badge notifications emails. This limitation exists because the email template engine only whitelists two specific variables for badge messages: {user-name} (the member's username) and {badge-name} (the title of the badge). Because the numeric user ID variable is unavailable in this context, you cannot dynamically construct the standard profile URL format (community.{your-domain}.com/members/username-{userId}).

However, here’s workaround for this.

Step 1: Update Your Badge Email Template Button

<your_community_url>/p/find-profile?user={user-name}

Email Button HTML Example:

<!-- Profile Button -->
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border-radius: 4px;" bgcolor="#000000"><a style="padding: 12px 16px; border-radius: 4px; color: #ffffff; text-decoration: none; display: inline-block;" href="<your_community_url>/p/find-profile?user={user-name}" target="_blank"> View your profile </a></td>
</tr>
</tbody>
</table>

Step 2: Create the Custom Router Page

  1. Navigate to your Gainsight Community Control Panel and create a new Custom Page.

  2. Set the URL Slug / Path to: find-profile (This establishes the full URL as <your_community_url>/p/find-profile).

  3. Ensure the page visibility is set to logged in users.

Step 3: Add the Router Script to the Custom Page

Add an HTML widget to your newly created custom page and paste the following routing script:

<div style="text-align: center; margin-top: 120px; font-family: 'Helvetica Neue', Arial, sans-serif; color: #333333;">
<div class="profile-loader"></div>
<h2 style="font-size: 22px; font-weight: 600; margin-bottom: 8px;">Loading your profile...</h2>
<p style="font-size: 14px; color: #666666;">We are directing you to your community achievements.</p>
</div>

<style>
.profile-loader {
border: 4px solid #f3f3f3;
border-top: 4px solid #0052cc;
border-radius: 50%;
width: 44px;
height: 44px;
animation: spin 0.8s linear infinite;
margin: 0 auto 24px auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>

<script>
document.addEventListener("DOMContentLoaded", function() {
// 1. Extract the username parameter from the email link (?user=Mithila%20Jayalath)
const urlParams = new URLSearchParams(window.location.search);
const targetUser = urlParams.get('user');

if (targetUser) {
// 2. Silently query the public search results page in the background
fetch('/search?q=' + encodeURIComponent(targetUser))
.then(response => response.text())
.then(htmlContent => {
// 3. Scan the raw HTML for the unique profile URL format (/members/name-id)
const profileUrlRegex = /\/members\/[a-zA-Z0-9_\-.%]+-\d+/;
const match = htmlContent.match(profileUrlRegex);

if (match) {
// 4. Match found! Instantly route them to their public profile
window.location.href = match[0];
} else {
// Fallback: If profile isn't indexed yet, send them to the search results safely
window.location.href = '/search?q=' + encodeURIComponent(targetUser);
}
})
.catch(() => {
// Error fallback: send to search page
window.location.href = '/search?q=' + encodeURIComponent(targetUser);
});
} else {
// Safe fallback: No user parameter found, bounce to homepage
window.location.href = '/';
}
});
</script>

 

How this performs in action:

  • When a user clicks the email button: They are immediately sent to your public find-profile page.

  • During the split second they see the loader: The background JavaScript executes a lightning-fast fetch request against the search page, grabs the text contents, extracts the specific string containing the profile URL (including that hidden user ID number), and forces the browser forward.

  • The destination: The user lands directly on their clean, public profile overview where they can see their badges

Let me know if this workaround works for you :)

Translate
jvdc
jvdcAuthor
Expert ⭐️
May 21, 2026 1:16 PM UTC

​@Mithila Jayalath thanks

I did not try your solution in the end… as I thought of simply creating a custom page that lists all the badges earned by the user and the ones remaining to be earned (custom widget), and I'll link those notification to that page.

 

Translate
atwhite
Helper ⭐️⭐️⭐️
Nov 3, 2026 5:55 PM UTC

​@jvdc  How did you create a page like this? 

Translate
jvdc
jvdcAuthor
Expert ⭐️
Nov 3, 2026 6:11 PM UTC

Hey ​@atwhite , it’s a custom widget that uses the API to get all the platform’s badges, and then it uses the web sdk to identify which badges the current user has.

I’ve made it as a developper studio widget, but it is totally do-able as an HTML widget too.

As a matter of fact, once my Pulse Europe workshop recording is up, you can find out a bit more about this 👀 ​@AishaKothawala ​@Julian 

Translate