Custom Pixel tracking code to track user activity

Basically,

i wanted to know if it is possible and how can it be done.

  • User A visits a page on my site, clicks on a link (product) - each link has a unique ID.
    
  • User then taken to external site - product page
    
  • User then clicks 'buy now' and proceeds to checkout.
    
  • Once checkout process is completed pixel tracking called at the end.

i want to track if the purchase has been complete and return that unique link ID…

I have access to external website, so i can place tracking code.

thanks for the advice.