asigno Posted May 15, 2018 Share Posted May 15, 2018 Hi, IPB currently sets a cookie which has the ips4_member_id stored, I would like to also set the member group? Does anyone know how I'd do this? Thanks Link to comment Share on other sites More sharing options...
opentype Posted May 15, 2018 Share Posted May 15, 2018 Why do you wanna do this? Link to comment Share on other sites More sharing options...
asigno Posted May 15, 2018 Author Share Posted May 15, 2018 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 More sharing options...
Nathan Explosion Posted May 15, 2018 Share Posted May 15, 2018 Is the ad being placed using the IPS advertisement functionality? If so, use the group setting on the ad there instead. Link to comment Share on other sites More sharing options...
asigno Posted May 15, 2018 Author Share Posted May 15, 2018 Hi Nathan, the ad system (Ezoic) sits entirely outside of my server and code. The code isn't touched at all. The original server request is intercepted. Link to comment Share on other sites More sharing options...
Nathan Explosion Posted May 15, 2018 Share Posted May 15, 2018 Would they be able to pick up the group from a javascript variable in the html instead? Link to comment Share on other sites More sharing options...
bfarber Posted May 15, 2018 Share Posted May 15, 2018 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 More sharing options...
asigno Posted May 17, 2018 Author Share Posted May 17, 2018 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 More sharing options...
asigno Posted May 30, 2018 Author Share Posted May 30, 2018 Hi @Nathan Explosion I didn't think about this before, but a JS variable would work as I could use Google Tag Manager to create the cookie. Would this be an easier method and how would I go about this? Thank you Link to comment Share on other sites More sharing options...
bfarber Posted May 30, 2018 Share Posted May 30, 2018 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 More sharing options...
asigno Posted May 30, 2018 Author Share Posted May 30, 2018 Perfect thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.