exponea / exponea-react-native-sdk

MIT License
8 stars 13 forks source link

In-app content blocks display issues #107

Closed StuartPyper closed 10 months ago

StuartPyper commented 11 months ago

Hi, Please help, I have been trying to set up in-app content blocks with our app using the latest release (1.6.0) but have run into a few issues:

  1. If I implement the code shown in the docs: https://github.com/exponea/exponea-react-native-sdk/blob/master/documentation/IN_APP_CONTENT_BLOCKS.md it states that 'they work automatically after the SDK is initialized'. What I have experienced however is that they are not displaying at all by default. The only way I could get them to display was to set up an extra check that only returns the placeholders after await Exponea.isConfigured() is returned true. If I do that then it will sometimes show the content but the display is inconsistent.
  2. I understand you can only have one block per placeholder but I should be able to use multiple placeholders on the same screen? Like the point above, sometimes this will work fine and other times it will randomly not show different placeholders, just leaving a blank space. (Note for this experiment each placeholder on screen had a different ID)
  3. Preloading the content using inAppContentBlockPlaceholdersAutoLoad seems to make the inconsistent display of the banners worse rather than better.

I'm not sure what is going wrong as we have been successfully using older versions of the SDK in our app for push notifications for over a year now. From reading the doc, it seems that we shouldn't need to add any extra checks in order to display in-app content?

Note:

adam1929 commented 11 months ago

Hi @StuartPyper thank you for your reporting.

  1. Integration according to guide should be really enough. Could you please describe/show snippet for to set up an extra check ?
  2. Placeholder and block has N:M relation ship. It means that you may create In-app content block with multiple placeholder IDs (strings) and multiple content block messages could share same placeholder ID. Also, you are able to have multiple placeholder instances (InAppContentBlocksPlaceholder) with same or different IDs, at is up to you. Showing of content block depends on "filtering" and rotation what may cause non-showing of content block.
  3. Using of inAppContentBlockPlaceholdersAutoLoad should just load content block asap, it has no impact on filtering (if block is displayed or not).
StuartPyper commented 11 months ago
  1. To get them to show I had to add a useQuery:

    const checkEponiaIsConfigured = async () => await Exponea.isConfigured();
    
    const { data: isExponeaConfigured, refetch: refetchIsExponeaConfigured } = useQuery(
    'isExponeaConfigured',
    checkEponiaIsConfigured,
    {
      cacheTime: EXPONIAISCONFIGURED_CACHE_AND_STALE_TIME,
      staleTime: EXPONIAISCONFIGURED_CACHE_AND_STALE_TIME,
    }
    );

    and then on the page display the placeholder when the result was true:

    if (isExponeaConfigured) {
    return (
      <Stack css={{ flex: 1 }} justify="center">
        <InAppContentBlocksPlaceholder
          style={{
            width: '100%' 
          }}
          placeholderId={placeholderId}
        />
      </Stack>
    );
    }

it's almost as if the module needs a nudge in order to display.

  1. I'm aware you can target one placeholder with two separate blocks, we would like to do that also but in my test there are four different placeholders all targeted by 4 different content blocks so none of them have more than one block fighting for its place.
  2. It may be related to the first issue but trying to add inAppContentBlockPlaceholdersAutoLoad: ['in-app-content-test2'] inside Exponea.configure seems to make it worse rather than better.
adam1929 commented 11 months ago

Thank you for your response @StuartPyper

  1. Indeed, we'll discuss it internally. It is true, that using of InAppContentBlocksPlaceholder is reasonable only for configured SDK. There is no such "trigger" that SDK is initialised and InAppContentBlocksPlaceholder should be refreshed.
  2. Such a behaviour was not detected by us but we do some investigations. You should not face any limitations, you should be able to use 4 placeholders on same screen. This occurs on Android or iOS platform?
  3. I'm not arguing, just I'm not seeing any connection between autoLoad and presenting of content blocks (from technical point of view) Thank you for your patience
StuartPyper commented 11 months ago

"This occurs on Android or iOS platform?" Yes, I see the same issues on both.

adam1929 commented 11 months ago

Hi @StuartPyper thank you for all your reportings. Could you please escalate this with our support team please? We would like to see logs, messages, contents. We tested our Example app (you may see in github) and our tests passed. There may be few details that may concern:

  1. You may build placeholder before SDK init. Although you create fine react principle with isExponeaConfigured
  2. You may request messages where customer via identifyCustomer could receive but cannot see due to given consent, or another 'personalisation' reason

Thank you for your patience, we would like to investigate problem more deeply and see your setup & usecase. Please call support with more infos. Thank you

adam1929 commented 10 months ago

I'm closing this thread due to small amount of info :-/ Unable to reproduce on our side.