I am working with two segments associated with a profile merge rule "NO AUTHENTICATED PROFILE + CURRENT DEVICE". I am realizing the traits and should be realizing the segments, but I am not seeing them consistently in the demdex stuff object. Why are they sometimes present and at other times not?
There are a few different reasons why this behavior might occur, but the most common is likely due to the profile merge rule setting and authenticated states. When using the merge rule of "NO AUTHENTICATED PROFILE + CURRENT DEVICE" Audience Manager will not expect an authenticated state to be passed in and will therefore not look for any segments associated with the user Authenticated Profile. If this profile merge rule is being used for a given segment, but an authenticated state is being passed to Audience Manager as part of the event calls that are realizing the requisite traits for that segment in the authenticated profile, the segment will not always be returned in the response due to its association with the device profile and not the authenticated profile.
Lets look at an example. Lets say that I am working with the following two traits:
Trait1 with the rule "test_signal=1"
Trait2 with the rule "test_signal=2"
These traits are associated with the following segments (and both segments are using the "NO AUTHENTICATED PROFILE + CURRENT DEVICE" profile):
Segment 1 has a rule of "Trait1"
Segment 2 has a rule of "Trait2"
If, in the course of my history on a page, let's say that I performed the needed action for Trait1, thus leading to the following event call:
https://dcs-kscluster-stage.demdex.net/event?d_uuid=12345678901234567890123456789012345678&d_cid=dpid1%01dpuuid1&test_signal=1
This call passes my Audience Manager UUID, a Customer ID sync declaration that specifies a target Data Source (dpid1) along with the Customer ID (dpuuid1), as well as the signal for Trait1. Audience Manager would read in the data contained in both the device and authenticated profiles (we say for the sake of this example that both profiles were empty prior to this first call). As a result of this call Trait1 is realized and stored on the authenticated profile dpid1:dpuuid1 and Segment1 is realized and stored on the device profile.
Then, after further browsing I trigger the action needed to realize Trait2:
https://dcs-kscluster-stage.demdex.net/event?d_uuid=12345678901234567890123456789012345678&d_cid=dpid1%01dpuuid1&test_signal=2
The result of this second call would be that Audience Manager would again read from both the device and authenticated profiles. Since the same Data Source and Customer ID value has been passed, Trait1 is returned. Trait2 would also be realized as a result of the call, thus being stored in the authenticated profile. Segment2 would likewise be realized and stored on the Device profile. At this point, the expectation would be that we would see Segment1 realized and listed again. This however would not be the case. Even though Trait1 would be read from the authenticated profile, since Segment1 is associated with the Device profile - and Audience Manager is looking for realizations that are part of the authenticated profile - it would not be returned in the response.