How can I find the number of views all MATLAB questions have received?

Viewed 76

I want to calculate the total number of question views that a tag on Stack Overflow has. Let's say the tag is MATLAB. At present there are 88k questions asked on Stack Overflow with tagged . Now each of these questions has some views.

Is there a way for me to know the total question views that these 88k questions have together via Stack Exchange API?

1 Answers

There are quite a few questions and given that the API returns max 100 results per quota and it has a limit of 10k calls per day (when you use a key), I wouldn't suggest using it in this case. You may also get an error.

What I suggest is to use the Stack Exchange Data Explorer. Here is an example SQL query which should satisfy your rrequirement:

DECLARE @from_date AS date = '##FromDate##'
DECLARE @to_date AS date = '##ToDate##'
SELECT SUM(CAST(ViewCount AS BIGINT)) AS view_count FROM Posts
WHERE PostTypeId = 1 AND CreationDate > @from_date AND CreationDate < @to_date AND Tags LIKE '%##Tag##%'

This will sum the the ViewCount columnn's values, which are the number of views each question has. Since you want only questions, you need to have PostTypeId set to 1.

Here is the query live. Enter a tag name in the Tag input and Run Query! If the tag has many questions, then the query might time out.

Reference: Database schema documentation for the public data dump and SEDE on Meta Stack Exchange.

Related