Target users based on cookie value | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Sep 11, 2018 12:15 PM UTC

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);

})();

Arun Patidar

9 replies

kumar4585
New Participant
Feb 13, 2019 6:56 AM UTC

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.

Translate
Level 2
Jul 14, 2022 8:16 PM UTC

I hope, it will be really helpful for any location. As I read being in the UK information about it, it was written like at https://ejemplius.com/muestras-de-ensayos/contabilidad/ . But it wasn't available from France. I am not sure, what was it connected to. But it is not too complicated to fix this problem, yes?

Translate
Level 2
Oct 20, 2022 9:24 AM UTC

Muchas gracias por su respuesta con información útil. Estoy muy contento de saber más al respecto.

Translate
arunpatidar
New Participant
Sep 11, 2018 1:22 PM UTC

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

Translate
Arun Patidar
Level 2
Sep 11, 2018 1:04 PM UTC

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

Translate
arunpatidar
New Participant
Sep 11, 2018 12:54 PM UTC

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

Translate
Arun Patidar
Level 2
Sep 11, 2018 12:40 PM UTC

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

Translate
smacdonald2008
Level 10
Sep 11, 2018 12:35 PM UTC

Excellent response Arun!

Translate
arunpatidar
arunpatidarAccepted solution
New Participant
Sep 11, 2018 12:15 PM UTC

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);

})();

Translate
Arun Patidar