Configuration Experiment #D3

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
  1. Go to Account > My Workspaces
  2. Create a production workspace
  3. Go to Users > Add Users
  4. Add a user with email DanielMartinez@xyz.com
  5. Go to Plans > All Plans
  6. Create plan "Test"
    1. Choose "Monthly"
    2. Choose "By Individual"
    3. Choose "All Workspace Users"
    4. Choose "Revenue" > "Raw Value"
    5. Add a per-transaction reward with the following formula

    6. Create the plan
  7. Go to Transactions > Add Transactions
  8. Import your CSV file
  9. Wait 10 seconds for the import to finish
  10. Go to Transactions > All Transactions
    1. Write down transaction dates (first column)
    2. Notice that the date was converted to an exact time stamp

  11. Go to your PC
    1. Write down your PC's time zone
  12. Go to Settings > Time Zone
    1. Go to the Settings tab
    2. Write down the workspace time zone
  13. Go to Calculations > All Calculations
  14. Run a January 2021 calculation
  15. Run a February 2021 calculation
    1. Write down the payout for each (1 per credited transaction)  
  16. Open the January 2021 calculation
  17. Click on "Credits Details" (choose "Export All Fields")
    1. Write down transaction dates (second column)
  18. Go to your PC
    1. Change your PC's time zone to a later time zone
    2. Ex: if you are in Mauritius, select Pacific as a time zone
  19. Go to Transactions > All Transactions
  20. Refresh the page
  21. Write down transaction dates (first column)
    1. Why are dates different?
  22. Go to Calculations > All Calculations
  23. Re-run the January 2021 calculation (with delete)
  24. Re-run the February 2021 calculation (with delete)
    1. Write down the payout for each (1 per credited transaction)
    2. Are payouts the same?
    3. Did you expect them to be the same (since you changed your PC's time zone)?
  25. Open the January 2021 calculation
  26. Click on "Credits Details" (choose "Export All Fields")
    1. Write down transaction dates (second column)
    2. Are transaction dates the same as previously?
    3. Did you expect them to be different (since you changed your PC's time zone)?
  27. Go to your PC
    1. Restore your PC's original time zone
  28. Go to Settings > Time Zone
    1. Go to the Settings tab
  29. Change your workspace's time zone to a later time zone
    1. Ex: if you are in Mauritius, select Pacific Time as a time zone
  30. Save changes
  31. Go to Transactions > All Transactions
  32. Refresh the page
  33. Write down transaction dates (first column)
    1. Why are dates back to normal (since you changed your workspace's time zone)?
  34. Go to Calculations > All Calculations
  35. Re-run the January 2021 calculation (with delete)
  36. Re-run the February 2021 calculation (with delete)
    1. Write down the payout for each (1 per credited transaction)
    2. Are payouts the same?
    3. Did you expect them to be different (since you changed your workspace's time zone)?
  37. Open the January 2021 calculation
  38. Click on "Credits Details" (choose "Export All Fields")
    1. Write down transaction dates (second column)
    2. Are transaction dates the same as previously?
    3. 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 ...