Trigger visitor group with anchor link #

Vote:
 

I have an anchor link on a page that leads to a different block on the same page. Now, when I click that anchor link I want (the user) to become a member of a certain visitor group. And I want the block I am linking to, to update according to the visitor group I just joined.

Would that even be possible?

Using Episerver.cms 11.9.2.0

#292524
Dec 01, 2022 14:43
Vote:
 

It's certainly possible though obviously there's the issue that the anchor link is client-side and the visitor groups are evaluated server-side so you need a mechanism to let the server know when the anchor has been clicked. I think the easiest route would probably be to set a cookie using JavaScript when the user clicks the anchor. You could then use JavaScript to make a request back to the server to refresh your block content. That request to the server should include the cookie so the user could be added to a visitor group based on the existence of the cookie.

For the visitor group itself, there's no inbuilt cookie criterion but there is a NuGet package which adds cookie criteria or, if you prefer, it would be really easy to build your own. The package is here:

https://nuget.optimizely.com/package?id=CookieVisitorGroupCriteria 

#292574
Dec 02, 2022 9:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.