I am using the Delivery API to fetch Recommendations data in a JavaScript script. Currently, I am reading the mbox cookie in order to get the sessionId. Then I use the sessionId to call the Delivery API. I am not providing a visitor id such as tntId. This is working fine for me and is maintaining the correct Activity Experience per visitor.
However, the Delivery API documentation has this to say regarding tntId: (source: https://developer.adobe.com/target/implement/delivery-api)"Object that contains the identifiers for the visitor. If no id is provided in the first request, Target will generate a VisitorId with a tntId. The code that runs on the client side is then responsible for passing this tntId value on all subsequent calls."
I'm not sure this applies to my case as my script only runs once per page load, and it is already working correctly. However, even if I run it concurrently, it works correctly. Do I need to store and pass the tntId somehow? For what reason? How can I troubleshoot whether I'm doing so correctly?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @MarinCa
Seems you are doing correctly however few points needs to consider about tntId
The tntId
is matter for consistent personalized experience across session and api call and also it prevent target to generate a new tntId
for every request.
In your case currently it behaves correctly because the sessionId
aligns within the same session, but it may break for returning visitors or concurrent calls without a persistence of tntId
.
so I would suggest - you can also provide the tntId
in your request. Like Read the tntId
from mBox Cookie ( you can see the tntId
starts with PC .....) and pass this ID in your Delivery API request. For future request you can save in locaStorage.
Hope this helps.
Views
Replies
Total Likes
Hi @MarinCa
Seems you are doing correctly however few points needs to consider about tntId
The tntId
is matter for consistent personalized experience across session and api call and also it prevent target to generate a new tntId
for every request.
In your case currently it behaves correctly because the sessionId
aligns within the same session, but it may break for returning visitors or concurrent calls without a persistence of tntId
.
so I would suggest - you can also provide the tntId
in your request. Like Read the tntId
from mBox Cookie ( you can see the tntId
starts with PC .....) and pass this ID in your Delivery API request. For future request you can save in locaStorage.
Hope this helps.
Views
Replies
Total Likes
I don't understand how storing the `tntId` in localStorage would be any different from reading it from the mbox cookie on page load. My request only runs once when the page is loaded, won't the `tntId` in the cookie always be correct?
Views
Replies
Total Likes
Following up here, @Gokul_Agiwal, can you please clarify this if you have time? I have already discussed this in a meeting with Adobe support and they were unable to answer my question.
Why do I need to store the tntId in localStorage if I can always access it from the mbox cookie? Won't the mbox cookie always accurately identify the current visitor?
Views
Replies
Total Likes
I reached out to support and they confirmed that it is fine to always read the mbox cookie as a source for the tntId. You don't need to store it in localStorage or elsewhere. Otherwise this answer is working for me.
Views
Replies
Total Likes
Views
Likes
Replies