Active Campaign thrivecart RFM.
RFM stands for recency, frequency and monetary value. What we want to do is when somebody purchases or refunds a thrivecart order, we want to update their ActiveCampaign profile with that information. Recency represents how recently did the customer purchase, that's a date. Frequency is how often do they purchase, quantity. Monetary value is how much do they spend, value.
Now, good old Wikipedia gives an explanation of exactly what this is. What's highlighted in red in the first box is what I just explained. The bottom box says that recency and frequency are basically in groups, you group them into sections, and you scale it from one to 10. So for instance, one month back to month back, etc. Frequency, recency with the that frequency is how many, but they cap it at a certain value.
I'm doing it a little bit different. My data is simply analog and it's exactly what's happened. Recency is the exact date they purchased and frequency is the exact number of purchases they've made and monetary represents simply the dollar amount. Now one thing to note about the way I'm going to show you how this is done is I keep track only of purchases not have refunds and the reason I do that is because thrive card allows you to refund partially.
So for instance, somebody could buy once, get refund partial, get another refund partial, get another refund partial, so you've got one order and three refunds, that would be negative two orders. That's not right. Instead, we always increment or decrement, the value the amount of money, we only count the number of purchases, and we only date the purchases. So let's dive right in.
We're going to install a script on your website. This is not for WordPress, you basically have to copy this, paste it in, make some changes. Let's go ahead and do that. So I'm going to copy this code starting right here at the top all the way down to this last closing brace, I need to log into my hosting Cpanel account, I've created a subdirectory called thrivecary and in there, I'm going to create a file called index.php, I'm gonna go ahead and create that new file and then what I want to do is edit the file, paste in the contents there.
And I do need to make some edits and I'm going to show you there's three things that need to be done here. When we want this to go live, we want this allow test to be set to NO but because I want to do some testing, I'm going to change that to YES for now. But do remember, you want to put it back to NO so that you don't catch test transactions. We also need our Active Campaign URL and API key.
So inside your Active Campaign account, I'm gonna go down to settings, developer and I want to underneath API access, I want to copy the URL back to the file, paste it in between those single quotes for URL. Now for API key, I go back here, copy the key back to index and I do this, paste that in and now I need to create some custom fields and I would recommend I've already typed in the values I expect you to do.
And I'm going to go ahead and do that in Active Campaign buthese are the values that we're going to use. So let me show you what to do here. We want to go to lists, manage fields and then I'm going to add three fields. The first one is RFM last date and you want to just leave it doesn't matter which group you want it to be a date field. So I'm going to go ahead and do that click add.
Second one is RFM quantity and that's going to be a text input and then the last one is RFM value and again, a text input. So all of these are available for any lists that somebody joins on your in your Active Campaign account. So we've got those, so that means I don't need to make any changes to this right here, if I called it something else and let me go right back there. Notice this is the personalization tag that we need.
So RFM underscore last underscore date, which I've already done here. So really, you shouldn't have to do anything. So now go ahead and save that. Now inside our thrivecart account, we want to send information over to this script. Whenever a purchase refund, basically anything occurs, I want to go into thrivecart, I want to go to settings, API and web hooks, bottom Right.
For web hook notifications, I want to go to View Settings, I want to click on add another web hook and I'm going to call it RFM and I want to give it the URL that it's located at to my thrivecart directory that I created and it's the index dot php. and actually you do not need to specify it but I would just do that for good measure. Click Save this web hook. Now I just want to point out that we've we're allowing test transactions to occur.
So I just want to make sure it works once it works and changes to NO. Now, next thing to do is make a test purchase. So I'm going to go ahead and do here I've got a product in test mode. So I'm gonna simply going to get the URL and I'm going to go ahead and make a test purchase. And just need to click order complete or complete order and one thing to note about thrivecart, they're going to send over information that says 9900.
So that's $99 and zero cents, we could do the math or take another value that gives you 99.00. I'm going to let you do that on your side. But it's going to show up as 9900. So I'm going to go ahead and complete the order. And I've got it wrong. Thank You page. But now what I want to do is I'm going to go search for that user and notice RFM last date is today June 1 2019, I've had one order, the total value is 9900 pennies, $99.
So there now if I went and made another purchase, and guess what, I'm simply going to buy the exact same product again. Now the date is going to stay the same, it would have update, updates, but it happens to be the same date quantity should increase by one and the value should double. So now I'm up to two transactions, total value is 19 hundred ninety eight dollars is what it is.
Now let's go back into thrivecart and refund part of that purchase. So here's something you might not know I want to see my test transactions. So in the URL at the top, I go to the very end and I put a dash test, and then go ahead and hit return and notice this goes into test mode and as you can tell I'm having a bad day over here for refund.
So I'm going to go down here I'm going to click on View and I've got today's date I've done a number already and I got two transactions I'm going to do a partial refund and let's see my feeling generous or not, let's do $40 go ahead and refund that. The dates not going to change the quantity is not going to change the RFM value should go down. So the value did decrease the quantity stayed the same, and the date has not changed.
So that's how you set up Active Campaign thrivecart RFM. And in the next video, I'll show you how to use that information.