Quick answer
A data type is a classification that tells a program, database or analyst what kind of value a field holds, such as an integer, a decimal number, text, true/false or a date, and therefore which operations are valid on it.
What are data types?
A data type tells a program, a database or an analyst what kind of value a field holds, and therefore what you can do with it. You can add two integers, but not two pieces of text; you can sort dates by time, but only if they are stored as dates. Choosing the right type is the difference between a revenue total and an error.
The phrase has two common meanings: programming data types (integer, string, boolean…) and statistical data types (nominal, ordinal, interval, ratio). Analytics needs both.
Common programming data types
| Type | Holds | Example | Watch out for | ||
|---|---|---|---|---|---|
| Integer (int) | Whole numbers | 42, -7 | Overflow on very large IDs | ||
| Floating point (float, double) | Numbers with fractions | 19.9, 0.333 | Rounding: 0.1 + 0.2 is 0.30000000000000004 | ||
| Decimal | Exact fractional numbers | 19.90 | Slower; use for money, or store cents as integers | ||
| String (str, text) | Text | "pro", "00123" | Numbers stored as text do not add up | ||
| Character (char) | One character | 'A' | Rare outside low-level languages | ||
| Boolean (bool) | True or false | true | "false" as text is truthy in many languages | ||
| Date / time / datetime / timestamp | Points in time | 2026-11-07T09:30:00Z | Time zones | ||
| Null / None | No value | null | Not the same as 0 or "" | ||
| Array / list | Ordered collection | ["red", "blue"] | Hard to filter on in many tools | ||
| Object / map / dict | Key-value pairs | {"plan": "pro"} | Nested data needs flattening for reports | ||
| Enum | One of a fixed set | `"free" \ | "pro" \ | "vip"` | Changing the set breaks old data |
JSON data types
Most analytics data travels as JSON, which has only six types (RFC 8259): string, number, boolean, null, object and array. There is no date type and no distinction between integers and decimals. That is why dates are sent as ISO 8601 strings (2026-11-07T09:30:00Z) or as Unix timestamps, and why money is often sent in the smallest unit (cents) as an integer.
Statistical data types
Statisticians classify data by what comparisons make sense, following S. S. Stevens' levels of measurement:
| Level | Meaning | Example | Valid summaries |
|---|---|---|---|
| Nominal | Categories, no order | Country, browser, plan | Counts, mode |
| Ordinal | Ordered categories, unequal gaps | Satisfaction 1–5, T-shirt size | Median, percentiles |
| Interval | Equal gaps, no true zero | Temperature in °C, calendar year | Mean, differences |
| Ratio | Equal gaps and a true zero | Revenue, session length, page views | Mean, ratios ("twice as long") |
Nominal and ordinal data are qualitative; interval and ratio are quantitative. Numbers can be stored for ordinal data (a 1–5 rating), but averaging them assumes the gaps are equal, which they often are not. Data can also be discrete (counts: 3 orders) or continuous (measurements: 3.27 seconds).
Why data types matter in analytics
- Sums and averages need numbers. A price sent as
"19.90"is text; most tools skip it in a sum or reject it. - Sorting depends on type. As text,
"100"sorts before"19.90"because1<9character by character. - Booleans as text split one property into
true,"true","True"and"1". - Dates without a time zone shift events across midnight when someone in another region reads the report.
- IDs as numbers lose leading zeros (
00123becomes123) and precision above 2⁵³ in JavaScript.
A worked example: revenue undercounted
Sample data: 5,000 purchase events in a month, average price $40. An older app version sends price as a string; the current one sends a number.
| Events | Revenue at $40 average | |
|---|---|---|
price sent as a number | 4,100 | $164,000 (summed) |
price sent as a string | 900 | $36,000 (not summed) |
| Total | 5,000 | $200,000 |
The dashboard shows $164,000: 18% of revenue is missing, and the gap grows or shrinks with the share of users on the old app version, so it looks like a real trend. Nothing errored; the type was simply wrong. The fix is in two places: send a number from the app, and validate the type at intake so the problem is caught the day it starts.
Rules for typed event properties
- Decide each property's type in the tracking plan and never change it; add a new property instead.
- Numbers as numbers, money in a consistent unit and currency.
- Booleans as
true/false, not strings. - Dates as ISO 8601 with a time zone, or Unix timestamps.
- IDs as strings, so leading zeros and long values survive.
- Keep categories to a known set to control cardinality.
Data types in TapCub
- On the website,
tapcub.track(name, props)keeps up to 20 property keys and keeps only strings, numbers and booleans; send dates as ISO 8601 strings. See track custom events. - All-platform analytics › Data › Property dictionary records each key's type: String, Number, Boolean, Datetime or List. Once you confirm a type, later scans do not overwrite it.
- Validation rules there can require an expected type and, on violation, warn, drop the property or block the event, which would have caught the string prices above on day one.
Sources
- Bray, T. (ed.) RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format (2017).
- W3C, Date and Time Formats (ISO 8601 profile).
- Stevens, S. S. (1946). On the Theory of Scales of Measurement. Science, 103(2684).
- MDN Web Docs, JavaScript data types and data structures.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Engineer
Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.