Sharing cookies between subdomain.domain.com and .domain.com

Hello,

I’m trying to install affiliates and marketplace plugins to work together.

I would like affiliates referrals to be valid across all network:

affiliate link -> main domain -> any subdomain -> product sale

Can you help in how i should do it?

+Thank you!