lytics / pathforajs

Web personalization SDK
https://www.lytics.com/
MIT License
2 stars 0 forks source link

[FR] add ability to hide a modal for a definable period of time at both modal and global level #613

Closed markhayden closed 3 years ago

markhayden commented 3 years ago

We currently have a display condition to prevent a modal from showing more than X times per session. This setting is either executable at the single modal layer (only limit this modal to one per session) or at the global layer across all modals (only allow one impression from any modal during this session).

Unfortunately, the session has proven to be problematic for a few reasons:

  1. session storage resets if you open a new tab
  2. session storage is not flushed on the same interval as our tag
  3. sessions in general have loose definitions and understandings which leads to confusion (i thought the session was 10 minutes...I thought it was expanded only on page view interactions...etc.)

As an alternative, we would like to give control over the duration as part of the definition. So the statement becomes "hide this modal for this period of time after this number of impressions". Said rule would then adhere to both individual modal or global capabilities like session ("I want to prevent any modal from showing for 24 hours after this modal gains an impression")

The actual JSON definition would look something like this:

displayConditions: {
  impressions: {
    widget: {
        total: 1,
        duration: 3600 // seconds
      },
    global: {
      total: 1,
      duration: 3600 // seconds
    }
  }
}

In the above example, we'd need to extend the existing "total" option to support the global setting and then introduce a duration setting. if the duration was not set it would default to the existing session setting which would maintain backward compatibility.

Finally, this setting should also be added to the app UI as a manageable display condition from the Experience Wizard.

image

ashyablok commented 3 years ago

@markhayden as noted today in the docs, total is not supported at the global level, is that a problem pertaining to this feature request?

ashyablok commented 3 years ago

jk, I missed this in the PR description. :facepalm:

In the above example, we'd need to extend the existing "total" option to support the global setting

ashyablok commented 3 years ago

@markhayden Just clarifying this config you provided:

displayConditions: {
  impressions: {
    widget: {
        total: 1,
        duration: 3600 // seconds
      },
    global: {
      total: 1,
      duration: 3600 // seconds
    }
  }
}

should actually mean: "I want to prevent this modal from showing for 24 hours after any modal gains an impression".

But applied to the global account config under the generic key this would mean: "I want to prevent any modal from showing for 24 hrs after any modal has gained an impression".