Was bored tonight so I decided to learn PHP and make a script to work with the OfficeAutopilot API.
I was inspired by some of Jermaine Griggs stuff over at automationclinic.com…
So I created a Customer Value Calculator script that does 3 things:
- increments a custom field called ‘Number of Purchases’ by 1.
- updates lifetime value (amount of money spent with you) by the last transaction amount
- calculates the average transaction value (LTV divided by # of Transactions)
Admittedly simple. But for a first stab I am pleased because it is handling something that was previously setup with a step sequence.
I made a short video here: http://screencast.com/t/F4LJuJ5vPeg It is just a quick overview of what it does.
What you’ll need to do:
1. In the OAP Field Editor create a custom Section called ‘Buying Cycles’ and add the following fields:
‘Number of Purchases’ as a numeric type.
‘Lifetime Value’ as a currency type
‘Average Transaction Value’ also as a currency type.
2. Copy the code from pastebin http://pastebin.com/m5yStBr4 and add it as a .php script to your server.
3. Add your OAP App ID and App Key (around line 63).
4. Create an Active Response rule in OAP when a contact makes a purchase to ping the url. The script has an example of what it should be.
I’d love to hear feedback on how I can make this better, more efficient and what you are doing with scripts like this for Office Autopilot or Infusionsoft.