Do I need to pass the tntId while using Delivery API if it's working fine? | Community
Skip to main content
MarinCa
Level 2
January 23, 2025
Solved

Do I need to pass the tntId while using Delivery API if it's working fine?

  • January 23, 2025
  • 1 reply
  • 871 views

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?

Best answer by Gokul_Agiwal

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 tntIdin your request. Like Read the tntIdfrom mBox Cookie ( you can see the tntIdstarts with PC .....) and pass this ID in your Delivery API request.   For future request you can save in locaStorage. 

 

Hope this helps. 

1 reply

Gokul_Agiwal
Community Advisor
Gokul_AgiwalCommunity AdvisorAccepted solution
Community Advisor
January 23, 2025

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 tntIdin your request. Like Read the tntIdfrom mBox Cookie ( you can see the tntIdstarts with PC .....) and pass this ID in your Delivery API request.   For future request you can save in locaStorage. 

 

Hope this helps. 

MarinCa
MarinCaAuthor
Level 2
January 24, 2025

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?