TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What are data types? Programming, statistical and analytics examples

A data type tells a computer, or an analyst, what kind of value a field holds and what you can do with it. Common programming types, JSON types, statistical types, and how a wrong type silently breaks analytics.

Lucas Hayes Reviewed by Chen Yu Also called data type Last updated Nov 7, 2026 Glossary

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

TypeHoldsExampleWatch out for
Integer (int)Whole numbers42, -7Overflow on very large IDs
Floating point (float, double)Numbers with fractions19.9, 0.333Rounding: 0.1 + 0.2 is 0.30000000000000004
DecimalExact fractional numbers19.90Slower; 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 falsetrue"false" as text is truthy in many languages
Date / time / datetime / timestampPoints in time2026-11-07T09:30:00ZTime zones
Null / NoneNo valuenullNot the same as 0 or ""
Array / listOrdered collection["red", "blue"]Hard to filter on in many tools
Object / map / dictKey-value pairs{"plan": "pro"}Nested data needs flattening for reports
EnumOne 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:

LevelMeaningExampleValid summaries
NominalCategories, no orderCountry, browser, planCounts, mode
OrdinalOrdered categories, unequal gapsSatisfaction 1–5, T-shirt sizeMedian, percentiles
IntervalEqual gaps, no true zeroTemperature in °C, calendar yearMean, differences
RatioEqual gaps and a true zeroRevenue, session length, page viewsMean, 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" because 1 < 9 character 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 (00123 becomes 123) 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.

EventsRevenue at $40 average
price sent as a number4,100$164,000 (summed)
price sent as a string900$36,000 (not summed)
Total5,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

  1. Decide each property's type in the tracking plan and never change it; add a new property instead.
  2. Numbers as numbers, money in a consistent unit and currency.
  3. Booleans as true/false, not strings.
  4. Dates as ISO 8601 with a time zone, or Unix timestamps.
  5. IDs as strings, so leading zeros and long values survive.
  6. 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

Was this explanation clear?

We use your answers to fix and expand this page.

Lucas Hayes

Data Engineer

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

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What are the basic data types?

Integer (whole numbers), floating-point or decimal (numbers with fractions), string (text), boolean (true/false), and date/time. Most languages add null, arrays or lists, and objects or maps.

What are the four types of data in statistics?

Nominal (categories without order), ordinal (ordered categories), interval (equal steps, no true zero, such as temperature in °C) and ratio (equal steps with a true zero, such as revenue or session length).

Why do data types matter in analytics?

Because sums, averages, sorting and filters depend on them. A price stored as text cannot be summed, and the text '100' sorts before '19.90'.

Is a date a string or a number?

Neither, conceptually; it is its own type. Formats like JSON have no date type, so dates are sent as ISO 8601 strings (2026-11-07T09:30:00Z) or as Unix timestamps (numbers).

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics