Configuration Experiment #D3
Goal
The goal of this experiment is to help you understand how configuration changes impact transactions. For this challenge, you will use a production workspace and enter some configuration. When asked to write down something, please copy the value to a document (along with the step #), as you will be using those values later on.
Difficulty
Easy.
Preparation
Create a CSV file with the following:
- Date,Unique ID,Owner,Revenue,Customer
- 2021-01-01,ID-1,Daniel Martinez,100,A
- 2021-01-01,ID-2,Daniel Martinez,100,B
- 2021-02-01,ID-3,Daniel Martinez,1000,C
- 2021-02-01,ID-4,Daniel Martinez,1000,D
As you can see, 2 records are in January, and 2 are in February. Their date is on the 1st of the month (at midnight).
Background Information
Time is relative. For example, "2021-01-01 at 2 AM" does not mean anything. You need to know the time zone for it to make sense. Obviously, 2 AM in Paris is different from 2 AM in Tokyo. Sales Cookie stores all dates as UTC. When displaying dates to users, we must convert UTC dates (in our database) to the user's current time zone. When running calculations, we use a reference time zone to decide whether each transaction is eligible for a given calculation period (ex: January). When transactions are imported from CSV (and no time zones are specified), we must also make a decision as to which time zone is implied.
Steps
- Go to Account > My Workspaces
- Create a production workspace
- Go to Users > Add Users
- Add a user with email DanielMartinez@xyz.com
- Go to Plans > All Plans
- Create plan "Test"
- Choose "Monthly"
- Choose "By Individual"
- Choose "All Workspace Users"
- Choose "Revenue" > "Raw Value"
- Add a per-transaction reward with the following formula
- Create the plan
- Go to Transactions > Add Transactions
- Import your CSV file
- Wait 10 seconds for the import to finish
- Go to Transactions > All Transactions
- Write down transaction dates (first column)
- Notice that the date was converted to an exact time stamp
- Go to your PC
- Write down your PC's time zone
- Go to Settings > Time Zone
- Go to the Settings tab
- Write down the workspace time zone
- Go to Calculations > All Calculations
- Run a January 2021 calculation
- Run a February 2021 calculation
- Write down the payout for each (1 per credited transaction)
- Open the January 2021 calculation
- Click on "Credits Details" (choose "Export All Fields")
- Write down transaction dates (second column)
- Go to your PC
- Change your PC's time zone to a later time zone
- Ex: if you are in Mauritius, select Pacific as a time zone
- Go to Transactions > All Transactions
- Refresh the page
- Write down transaction dates (first column)
- Why are dates different?
- Go to Calculations > All Calculations
- Re-run the January 2021 calculation (with delete)
- Re-run the February 2021 calculation (with delete)
- Write down the payout for each (1 per credited transaction)
- Are payouts the same?
- Did you expect them to be the same (since you changed your PC's time zone)?
- Open the January 2021 calculation
- Click on "Credits Details" (choose "Export All Fields")
- Write down transaction dates (second column)
- Are transaction dates the same as previously?
- Did you expect them to be different (since you changed your PC's time zone)?
- Go to your PC
- Restore your PC's original time zone
- Go to Settings > Time Zone
- Go to the Settings tab
- Change your workspace's time zone to a later time zone
- Ex: if you are in Mauritius, select Pacific Time as a time zone
- Save changes
- Go to Transactions > All Transactions
- Refresh the page
- Write down transaction dates (first column)
- Why are dates back to normal (since you changed your workspace's time zone)?
- Go to Calculations > All Calculations
- Re-run the January 2021 calculation (with delete)
- Re-run the February 2021 calculation (with delete)
- Write down the payout for each (1 per credited transaction)
- Are payouts the same?
- Did you expect them to be different (since you changed your workspace's time zone)?
- Open the January 2021 calculation
- Click on "Credits Details" (choose "Export All Fields")
- Write down transaction dates (second column)
- Are transaction dates the same as previously?
- Did you expect them to be different (since you changed your workspace's time zone)?
Key Learnings
- All dates are stored in UTC format within the Sales Cookie database
- Dates are displayed to users based on their own time zone
- Each workspace has a reference time zone which determines
- Which transactions are eligible for a calculation period
- Which time zone is implied when uploading transactions
- In the example above, we changed the workspace time zone to an earlier time zone
- Therefore, transactions on Jan 1st were dated Dec 31st from the perspective of this time zone
- Therefore, transactions on Feb 1st were dated Jan 31st from the perspective of this time zone
- So the Jan 2021 calculation picked up 2 Feb transactions
- So the Feb 2021 calculation picked up nothing
- To see what customers see, you may need to change your PC's time zone and refresh
- When importing transactions from CSV, check that the workspace time zone is correct for the customer
- There are special functions to convert between UTC and the workspace's time zone
- Calculations take into account daylight saving changes when using the workspace's time zone
- There are some date formatting options under Account > My Profile
Related Articles
Configuration Experiment #D1
Goal The goal of this experiment is to help you understand how configuration changes impact transactions. For this challenge, you will use a production workspace and enter some configuration. When asked to write down something, please copy the value ...
Configuration Experiment #V6
Goal The goal of this experiment is to help you understand how to use custom variables in your configuration. For this challenge, you will use a production workspace and enter some configuration. When asked to write down something, please copy the ...
Configuration Experiment #D2
Goal The goal of this experiment is to help you understand how configuration changes impact transactions. For this challenge, you will use a production workspace and enter some configuration. When asked to write down something, please copy the value ...
Configuration Experiment #V5
Goal The goal of this experiment is to help you understand how to use custom variables in your configuration. For this challenge, you will use a demo workspace and enter some configuration. When asked to write down something, please copy the value to ...
Configuration Experiment #V3
Goal The goal of this experiment is to help you understand how to use custom variables in your configuration. For this challenge, you will use a demo workspace and enter some configuration. When asked to write down something, please copy the value to ...