share sheet with custom link

Hi,

I'm new to share sheet and I've run into some problems trying to achieve what I want.

I'd like to share a link, so I included a link in the activityItems. At the same time, I'd like to append a tag to the link so I can track the user activities(shared from which app), to achieve this, I implemented UIActivityItemSource

public func activityViewController(_ activityViewController: UIActivityViewController,
                                       itemForActivityType activityType: UIActivity.ActivityType?) -> Any?

and returned different links for different activityType. However, the conundrum I'm in right now is after my implementation, I end up sharing two links, but if I remove the link in activityItems, I don't get some apps in my share sheet(for example IG). What can I do in this case to still keep track of app activities as well as only sharing one link?

share sheet with custom link
 
 
Q