Forum Discussion
Hi Nathan,
Thanks for the reply and the welcome :smileyhappy:
Yes I have already tried just using ${http.request.referrer} in the custom component, which works fine if I'm just clicking a direct link to the page, but I probably didn't explain my problem fully.
I'm trying to capture referrals from a particular domain that we're using in an advertising campaign and redirect them to a custom page before signup using the Page Initialization feature. I've got that part working fine with the following:
<#if http.request.serverName?ends_with("domain.com") && page.name != "Forum-Access">
${http.response.setRedirectUrl("${community.urls.tapestryPrefix}/custom/page/page-id/Forum-Access")} <#else> </#if>
The problem is, I also need to capture the referring url as part of the project requirements and when using the redirect to the custom page, ${http.request.referrer} just returns "The widget could not be displayed".
So I've figured that I need to capture the referrer as part of the Page Initialization script and forward it on to the custom component... and that's where I'm stuck at the moment.
Any ideas would be greatly appreciated.
Cheers
So having stared at it for a while I realised that because I had the redirect in place what I actually needed was to get the http.request.url in to the session rather than the http.request.referrer
So the following achieved the result I was after:
<#assign referrerUrl = http.request.url /> ${http.session.setAttribute("forwardUrl", referrerUrl)}
and the original url that was clicked on was displayed on the custom component.
Related Content
- 4 years agoInactive User
- 5 months ago