Debugging Integration Issues

This guide discusses common problems and how to resolve them.

Missing or incorrect anonUserId

The Problem

Promoted uses anonUserId to create personalized recommendations. anonUserId is also used as part of the key in the Delivery page database. If the anonUserId is not specified, Promoted does not know how to differentiate one user from another. If the anonUserId changes during paging, Promoted treats these as two completely different paged Requests.

To be safe, when anonUserId is missing, Promoted defaults to falling back to client-specific retrieval ranking. If this is an issue, please chat with Promoted's team. Promoted can walk you through alternatives and the additional information that is needed.

Likely top causes

Missing anonUserId is mostly an issue on web. Mobile apps usually initialize anonUserId very early on.

Common causes:

  • Race condition in web app loading and anonUserId initialization.
    • Example: If the list of content is pre-loaded on the first HTTP request for the index.html and the anonUserId is not initialized until after the html is executed on the browser-side.
    • Example: Extra async Javascript needs downloaded after page load to initialize the anonUserId.
  • The code that creates the anonUserId is blocked. E.g. if Segment is used to create a anonUserId, then privacy protectors that block Segment will cause anonUserId to not be set.
  • General coding bugs.

How will this issue be detected?

Promoted tracks the rate of missing anonUserIds. Promoted will report big changes to the "missing anonUserId rate" to you.

You might notice this internally if the items do not appear re-ranked. If anonUserId changes in between page calls, Promoted might duplicate content across pages.

Investigation steps

  1. Set up logging in your code to catch when anonUserIds are not specified.
  2. Audit the code flow from anonUserId to Promoted SDK calls.
  3. If there are interesting dimensions that might impact the problem (e.g. device, browser, authenticated userId), forward the values on Delivery calls and Impression records so Promoted can compare the missing anonUserId rates along the dimensions.
  4. See if this is an issue on the first page that a user visits vs subsequent pages.

Mitigations

  1. Fix race conditions and bugs in anonUserId initialization.
  2. Sync with the Promoted team to learn about alternatives.