Forum Discussion

ebonifacio's avatar
3 years ago

Identify users landing in the Community coming from a specific page

Hello!!

I would like to identify users landing in the Community that are signed in with their account from another website (that is ours too).  

Does anyone have some idea if this is possible / how to do it?

These users are going to see a message if they are coming from this other website.

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)

    Hi ebonifacio. I reached out to our Khoros Services team on this one. 

    Cookies are accessible through Freemarker or JavaScript, but that assumes that the relevant cookies are even available to Community. So depends entirely on how they’ve set things up on their side.

    I think reaching out to your Khoros contact (Customer Success Manager or Technical Account Manager) or Khoros Support might be a way to get started.

    I'm hoping that some of our Developer community members have more insight and experience to share. allensmith81 Claudius jeffshurtliff StanGromer?

    These FreeMarker objects have methods for working with cookies.

     

     

     

     

  • Hi ebonifacio,

    I'll keep looking into the cookie/referer method but, in the meantime, since you own the source website as well, one option you have is leveraging UTM query parameters.

    For example, whenever I am promoting community content on Twitter or other channels, I will include these or similar parameters in the URL:

    ?utm_source=twitter&utm_medium=tweet

     

    Or, as another example, if I am linking to the community from our corporate website I might add something like this:

    ?utm_source=corporate_website&utm_medium=banner

     

    Then you'd be able to capture that data in FreeMarker if it is defined and do with it what you will.  For example:

    <#-- Retrieve the utm_source and utm_medium values if defined -->
    <#assign utmSource = http.request.parameters.name.get('utm_source', '') />
    <#assign utmMedium = http.request.parameters.name.get('utm_medium', '') />

     

    Hope this helps!

    • jeffshurtliff's avatar
      jeffshurtliff
      Boss

      ebonifacio,

      I also just found the FreeMarker you need to capture the referer value, which is the source URL where the user came from.

      <#-- Get the referer URL -->
      <#assign referer = http.request.getHeader('referer')!'' />

       

      Simple enough. Then you can play with the URL however you need to determine where it came from.  For example:

      <#if referer?contains('google.com')>
        <p>You came here via Google!</p>
      <#else>
        <p>You did not come here via Google!</p>
      </#if>

       

      Hope this helps!