adobe / aepsdk-react-native

A wrapper around the iOS and Android AEP mobile SDK to allow for integration with React Native applications.
Apache License 2.0
15 stars 28 forks source link

How can I setup cusPreferredLanguage #292

Closed inpendio closed 10 months ago

inpendio commented 1 year ago

Hi,

so we have a situation where we need to set language for the subscriber. In the same table where we can find cloid ID, registration token, etc., there is a field Language (cusPreferredLanguage). How to set this field from react-native programmatically (and update it if language changes)?

yangyansong-adbe commented 1 year ago

Hi @inpendio , I can't understand your question. Can you provide further information on how you use our React Native SDK within your project? And, which SDK extension/package is causing the language issue?

inpendio commented 1 year ago

Nothing is causing the language issue. I just want to set up the preferred language for the user. The integration is basic, we followed the docs. Registration token and cloud ID are created automatically. But we want to set a preferred language for the user (subscriber), so that we can send notifications in the correct form.

The table below is where we want to affect changes. Screenshot 2023-09-28 at 17 26 40

yangyansong-adbe commented 1 year ago

Oh, I see. Which Adobe solution UI are you referring to? I can forward your question to the solution expert.

inpendio commented 1 year ago

This one, AEP. We had some support, but even they didn't know. I thought maybe developers know...

yangyansong-adbe commented 1 year ago

Hi @swarna04, this question seems to be related to a campaign. Can you help to provide some suggestions?

cc @dsoffiantini

swarna04 commented 1 year ago

@inpendio You can set up a launch rule with Send PII action (post body as shown below):

{
"marketingCloudId":
"{%%mcid%%}",
"cusPreferredLanguage":
"{%contextdata.preferredLanguage%}" 
}

For details, see https://experienceleague.adobe.com/docs/campaign-standard/using/administrating/configuring-mobile/configuring-rules-launch.html?lang=en#pii-postback. In the app, invoke Mobile Core's collectPii API and pass the desired preferredLanguage value in the dictionary.

MobileCore.collectPii({preferredLanguage: '<preferred-language>'});

Hope this helps! Please let us know if you run into any issues. Thanks.

inpendio commented 1 year ago

@swarna04 Tnx for the answer. We got the same answer from our support. But, for us, the provided method MobileCore.collectPii does not work. At least we don't see any changes in our dashboard. We currently use Pii URL, and we trigger it manually (fetch call, POST method, desired body attached to the call). This works for us. Not sure why, maybe the provided method is not called immediately and uses some sort of batch mechanism. So, please check that part. Either code or documentation for it needs to be updated.

Regards

swarna04 commented 1 year ago

@inpendio Thanks for your reply. Not sure I understand when you say that MobileCore.collectPii doesn't work! Do you not see the request made to ACS server with the configured post body? Have you verified the rule is configured as per the docs and published to the environment from where you select the environment file ID for your app? Do you have SDK logs to share (probably redacted) so that we can investigate this further? Please let us know. Thanks.

inpendio commented 1 year ago

@swarna04 Yes. When we tried to set language with MobileCore.collectPii we didn't see any changes in the dashboard. Once we used URL, we saw the changes. Rules are configured... How can we get SDK logs?

cacheung commented 11 months ago

@inpendio You can get the SDK logs from the native IDEs Debug Windows.

  1. Use MobileCore.setLogLevel and set the level to VERBOSE/TRACE, and call this API before any other SDK API call, even before extensions registration. See sample code here.

  2. iOS: In Xcode dev console (View → Show Debug Area) Android: Android Studio > logcat windows

Run the test steps and copy all the content in the log window to a text file and share with us.

cacheung commented 10 months ago

Closing the issue due to low activity. Please open a new issue if you have any other questions.

inpendio commented 10 months ago

Hi. Well, I don't know if you manage to solve it. We currently use Pii URL for this. And we don't have much time to debug it.