Jump to content

How push user's member group to cookie?


asigno

Recommended Posts

I want to use an ad platform which works behind their DNS, they dynamically intercept the request, edit and serve. I want to stop the serving of ads to a certain user group which they'd be able to lookup from a cookie.

Link to comment
Share on other sites

If you want to put the user's group into a cookie, you have a few things to consider.

1) You'd need to write a plugin to do this, as it doesn't happen out of the box. It's not difficult to do so, but it would be necessary.

2) Users can belong to multiple groups, so you'd want to set all of those groups and be sure your ad platform can read all of them. Whether that's a comma separated list or some other format though, you'd have to check with the ad platform.

 

Link to comment
Share on other sites

On 5/15/2018 at 7:54 PM, Nathan Explosion said:

Would they be able to pick up the group from a javascript variable in the html instead?

Good idea @Nathan Explosion, will check, hadn't thought to ask that.

On 5/15/2018 at 11:17 PM, bfarber said:

If you want to put the user's group into a cookie, you have a few things to consider.

1) You'd need to write a plugin to do this, as it doesn't happen out of the box. It's not difficult to do so, but it would be necessary.

2) Users can belong to multiple groups, so you'd want to set all of those groups and be sure your ad platform can read all of them. Whether that's a comma separated list or some other format though, you'd have to check with the ad platform.

 

Thanks @bfarber, seems like I've got a lot to learn then. Thought it might be as easy as adding a line of code to the existing method of setting the cookie.

Link to comment
Share on other sites

  • 2 weeks later...

In a template to use just the primary group:

<script>
  var groupId = {expression="\IPS\Member::loggedIn()->member_group_id"};
</script>

or for all group ids (comma-separated):

<script>
  var groupIds = "{expression="implode( ',', \IPS\Member::loggedIn()->groups )"}";
</script>

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...