The matching is done using IDFA (Apple) or AAID (Android), mobile terminal identifiers collected by the ad platform and the MMP.
MMP (Mobile Measurement Partner)
A Mobile Measurement Partner (MMP) is a marketing tool that measures media campaign performance by matching user actions within an app to clicks on advertisements.