Trying to get Affiliate traffic source for Sale

I’m trying to get the affiliate/traffic source information for an order via the API. I’ve queried the Contact, Job, Lead, LeadSource and Referral tables with no success. The data can be clearly seen on the contact’s Order Information page as seen below.

So you’re looking in the wrong table. The affiliate table is accessible to the api (not REST). If you use the api data object, you can just query that table :wink:

You can use the SDK with the same access token that REST uses for this as well :wink:

Hi John,

Thank you for your quick reply. My understanding is the affiliate table holds information about each affiliate.

When a customer buys our product through an affiliate, I’m looking to get the affiliate’s ad information that customer clicked on to make the purchase. The information is someone attached to the customer’s contact id but I can’t find that connection.

Do you mean their leadsource?

That’s what I would have hoped but checking that table with the LeadSourceId (from the Contact record) just returns a LeadSourceCategoryId, and a generic Name, not the PLM-BONUSPAGE that I’m looking for.

I’ve also checked the Leads table which doesn’t contain the Source.

Ah, Ok, gotcha.

So when the order is made, how are you capturing the order? Via an IS order page or possibly on your website? I ask because some setups would need to insert the tracking link into page in question. The other factor to be aware of is that leadsource is a “write once” field. So if my contact record was created by a process that registered the leadsource and I later ordered from Affiliate A’s order page, it would not get “re-written” because the system is setup to only allow the leadsource to be written to if it’s empty…there is a way around that but by default that’s what happens.

Hi John,

We are using the Infusionsoft Legacy Order form for the sale. What’s interesting is I can see the information on the member’s contact page and when I query the leadsource it’s just something generic not the name of the Ad (PLM-BONUSPAGE) the Affiliate setup. I’m starting to believe the information isn’t available via the API.

So that is likely a case of the leadsource having been determined prior to coming into the picture before the sale? Can you confirm if that might be the case? As I said, leadsource is a write once field. The “source” field you’re seeing there is a separate internal element of the contact and not the actual elements of the contact in the infusionsoft database. ie it’s a separate set of infomration stored apart from the general contact data. My thinking is that maybe that source information isn’t getting presented before the leadsource has a chance to be set by the process that is creating the generic one and therefor isn’t writing it that way because it’s write once and done. It would be possible for you to setup those pages with a custom field though that identified that page as the order leadsource because you can just add the html on that page as a hidden field that is named for a custom field and “hard code” the value for that element. When the order is submitted, it will also set the custom field to the value. In that way you’d be able to circumvent the limitation of the leadsource field.

Hi John,

I totally understand that the leadsource is write once and it certainly could be the case that it was set previously for this contact. But, Infusionsoft is pulling the correct source from somewhere which means they are storing it somewhere other than the leadsource. They wouldn’t be able to display it on the member’s contact page otherwise. I appreciate all your input and we should be able to use a custom field in the future, it’s just that our launch is almost over and I was just trying to retrieve data that seems to be stored somewhere.


I understand what you’re saying. However, there is no access to that information directly…ie there’s no way for you to reference it as it’s considered “internal”, which is why I suggested that you may be able to capture it in a custom field.

Ok, I understand, thank you John for all your help.

1 Like