The ad network is able to serve content natively through the domain of both A and B. That means they can send back a beacon pixel to Site B from Site A's domain, which will let them link the two ids. They only need to do it one time to link up the ids for a pair of domains.