Code Monkey home page Code Monkey logo

Comments (4)

rofe avatar rofe commented on July 1, 2024 1

@trieloff A few suggested changes:

  • set the window.helix.audience variable to the selected ID

I would (re)use window.hlx object for this which is already being used by the Sidekick. On the other hand, do we really need this variable if the selected audience is also broadcast via event and stored in localStorage?

  • fire a window.helix.on('audiencechanged') event

I would propose to fire the event on the window instead, as listening to an event on an object that may or may not exist (before the Sidekick is initialized, window.hlx yet would be cumbersome:

window.dispatchEvent(new CustomEvent('helix-audiencechanged`, { detail: audienceId }));

Then blocks can register listeners like this:

window.addEventListener('helix-audiencechanged', (evt) => console.log(evt.detail);

And a few questions:

  1. Who is the persona authoring the _audiences sheet, and where would they get the correct IDs from?
  2. In the production (i.e. non-simulation) scenario, where would the event be fired and the audience ID be stored in localStorage? I imagine we'd need a few helper functions to trigger this in a project's martech.js based on real data from EC...

cc @davidnuescheler

from helix-sidekick.

kptdobe avatar kptdobe commented on July 1, 2024 1

I agree with the first sentence of the issue description: we need a button in the sidekick. For the rest, I do not know. Talking about implementation details of the simulation without having defined the things which need to be simulated feels strange to me ;)
And apart from the button, I am also not sure if this really belongs to the sidekick.

I am going to create an issue for the personalised content.

from helix-sidekick.

trieloff avatar trieloff commented on July 1, 2024

Who is the persona authoring the _audiences sheet, and where would they get the correct IDs from?

The same person that defines audiences in AudienceManager. They get it from the AudienceManager UI.

In the production (i.e. non-simulation) scenario, where would the event be fired and the audience ID be stored in localStorage? I imagine we'd need a few helper functions to trigger this in a project's martech.js based on real data from EC...
On the other hand, do we really need this variable if the selected audience is also broadcast via event and stored in localStorage?

Oddly enough, this is the same question, asked twice.

The window.hlx.audience variable + helix-audiencechanged event shall be the main interface to use when building a compontent that interacts with audiences or uses targeting. The value will be populated from two sources:

  1. the AudienceManager JSON API (by using the Experience Cloud ID Cookie)
  2. the Cookie/LocalStorage/Sidekick UI

(2) overrides (1), so that a user with the sidekick can select audiences at any time.

from helix-sidekick.

rofe avatar rofe commented on July 1, 2024

Oddly enough, this is the same question, asked twice.

Sorry 😄

I figured we'd need some sot of "connecive tissue" between Audience Manager running on a page and blocks using personalization, to make sure that window.hlx.audience is set and/or the helix-audiencechanged event gets fired...

from helix-sidekick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.