Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Target users based on cookie value

Avatar

Level 3

We have integrated with target using the experience fragments approach. Now, There is requirement to targets users based on the cookie value in the browser. Do we have any approach apart from Target Audience Based on Cookie Value  mbox approach?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You can go with script reference segment.

Configuring Segmentation with ContextHub

which will uses js to register segment with clientlibs of category 'contexthub.segment-engine.scripts'

There is utility to interact with cookies i.e. ContextHub.Utils.Cookie

ContextHub Javascript API Reference

Example :

ContextHub.console.log(ContextHub.Shared.timestamp(), '[loading] contexthub.segment-engine.scripts - my-audience-segment.js');

(function() {

  var getMySegment = function() {

        var axes4="retail";

        var segAxes4=false;

      /*  if (ContextHub.Utils.Cookie.exists("axes1")) {

  segAxes4=true;

        } */

        if((ContextHub.Utils.Cookie.getItem("axes"))==axes4){

  segAxes4=true;

        }

        return segAxes4;

    };

    /* register function */

    ContextHub.SegmentEngine.ScriptManager.register('My-Retail-Segment', getMySegment);

})();

View solution in original post

7 Replies

Avatar

Correct answer by
Community Advisor

Hi,

You can go with script reference segment.

Configuring Segmentation with ContextHub

which will uses js to register segment with clientlibs of category 'contexthub.segment-engine.scripts'

There is utility to interact with cookies i.e. ContextHub.Utils.Cookie

ContextHub Javascript API Reference

Example :

ContextHub.console.log(ContextHub.Shared.timestamp(), '[loading] contexthub.segment-engine.scripts - my-audience-segment.js');

(function() {

  var getMySegment = function() {

        var axes4="retail";

        var segAxes4=false;

      /*  if (ContextHub.Utils.Cookie.exists("axes1")) {

  segAxes4=true;

        } */

        if((ContextHub.Utils.Cookie.getItem("axes"))==axes4){

  segAxes4=true;

        }

        return segAxes4;

    };

    /* register function */

    ContextHub.SegmentEngine.ScriptManager.register('My-Retail-Segment', getMySegment);

})();

Avatar

Level 3

I think the response is purely driven from AEM end. I'm looking for a solution with adobe target integration.

Avatar

Community Advisor

Yes, this is purely ContextHub based targetting. Not sure why you want to do with adobe target.

Avatar

Level 3

Activity,Audience and everything would be in target. We have control the content based on the browser cookie.

Avatar

Community Advisor

ok, then you can post similar question in adobe target community, if they can help.

Avatar

Level 1

give some examples regarding cookie based targeting, how to store values in cookies and getting back user data from cookie,

provide any reference links or examples to redirect a page based on location.