PHP API v2

Can we get the Javascript wrapping around this function extracted to its own function? This avoids repetition in `propensityToBuyTrackingEvent`