Forum Discussion
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!
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!
- ebonifacio3 years agoMentor
Thanks jeffshurtliff
I'm going to try this, it looks a better and easy solution.
Related Content
- 2 years ago
- 2 months ago