IF AN agency of your government asked whether you had recently smoked a joint and how much you paid for it, would you tell it? Canada’s statistics agency, informally known as StatCan, is about to find out what that country’s citizens would do. On January 23rd it will invite Canadians to disclose their cannabis habits anonymously through an app. Its nosiness is entirely professional. Canada’s government, led by Justin Trudeau, plans to legalise the recreational use of cannabis by July 1st. StatCan needs reliable data in order to incorporate the newly respectable consumer-goods sector into national accounts.

Ever since Mr Trudeau said during the election campaign in 2015 that a Liberal government would legalise marijuana, discussion has focused on who would be authorised to sell it and what level of government would get the money from cannabis taxes. Government departments in charge of health, tax, security and others are changing procedures and reassigning bureaucrats to prepare for legalisation.

StatCan has an especially tricky job. It has to estimate the contribution to the economy made by the production, distribution and sale of cannabis. To do that it must know what the cannabis economy looked like when lighting up was a crime. The last time Canada dealt with anything like this was in the 1920s, when prohibition ended and the Dominion Bureau of Statistics kept the national accounts.

“We can’t as national accountants just put in a number post-legalisation,” says Jim Tebrake, the StatCan official in charge of accounting for cannabis. That would make it look like the economy had got a sudden boost from activity that was already going on illicitly. To avoid that, the agency needs to publish data going back to 1961, the base year for the accounts. It will incorporate the data into the official figures once it is confident they are reliable. While Uruguay and several American states, including California, have legalised cannabis, Canada’s statisticians are using neither country as a model. Once Canadians can get legally bombed, measuring the worth of indulgence will get easier.

Just hunting for past data can be risky, as a researcher in Parliament’s budget office discovered. The legislature’s technology unit spotted that he was looking at weedy websites and amassing files of fragrant data and shut down his computer account. He had to persuade the in-house detectives that his work was legitimate.

Production is the most difficult part of the cannabis value chain to measure. “The producers are harder to find than the customers,” says Mr Tebrake. That is mainly because, unless they grow the stuff for the legal medical-marijuana market, they are mainly career criminals. In the United States, undercover agents sometimes collect data on production. Canada relies on information from police and border officials on seizures of cannabis. But those data depend on whether the traffickers or the police get lucky in a given year.

Health surveys by StatCan and other agencies are one way to measure consumption, but people do not always tell the truth about such habits. To arrive at a dollar value for the market, statisticians need information about price, too. StatCan, along with other agencies, has turned to priceofweed.com, where users anonymously post the amount, price and location of their purchases. The sample is far from perfect. The data come from just one source, and people who post on priceofweed.com may not be representative. The website lists just the 15 most recent buys for each location.

To get around that problem, StatCan looked at information gleaned by Dark Crawler, a piece of software that can roam the web in search of priceofweed’s past data. To go further back in time, it is gathering data collected by academics, including Luca Giommoni, an expert in illicit markets from Cardiff University in Britain, and David Décary-Hétu of the University of Montreal. StatCan’s crowdsourcing app will supplement rather than replace the priceofweed information.

On the day StatCan releases the app, it will publish its first estimates of the cannabis economy dating back to 1961 on a new cannabis hub. It will have a space for anyone to suggest more accurate data. If people think the price is too low, they will be able to suggest tweaks, which would raise the value of the cannabis economy. People on the street have a lot of information, says Mr Tebrake. (If they can remember it.)

Parliament’s budget office made a first stab at estimating the size of the market: it guessed that in 2018 Canadians would spend C$4.2bn-6.2bn ($3.4bn-5bn) on cannabis, or about 0.2% of GDP. That is a little less than they spend on beer. Before incorporating its estimates into national accounts, StatCan has to figure out how much existing activity, such as electricity used by illicit “grow-ops”, is being used in the cannabis economy.

After legalisation, StatCan plans to ask 10,000 households every three months how their behaviour has changed. “We see it almost as our statistical duty to try to develop a data set to measure this event,” says Mr Tebrake. The agency’s work might help other countries contemplating legalisation of black markets. The more smokers distort their perceptions of reality, the less statisticians can afford to do so.