{"id":2370,"date":"2020-12-08T22:28:01","date_gmt":"2020-12-09T03:28:01","guid":{"rendered":"https:\/\/xlinesoft.com\/blog\/?p=2370"},"modified":"2020-12-09T11:30:39","modified_gmt":"2020-12-09T16:30:39","slug":"analyzing-incoming-emails","status":"publish","type":"post","link":"https:\/\/xlinesoft.com\/blog\/2020\/12\/08\/analyzing-incoming-emails\/","title":{"rendered":"Analyzing incoming emails"},"content":{"rendered":"<p>As web developers, we deal with large amounts of data every day. Sometimes it helps to sit back and take a closer look at the data in hand and see what data is trying to tell. <\/p>\n<p>Here, at Xlinesoft.com customer support is one of the most important parts of the business. We deal with a large number of emails and helpdesk tickets every day and, as a small weekend project, we decided to build a few charts to analyze those emails. We are sharing these results here and hoping that it can provide you or your clients with some insights.<\/p>\n<p>First of all, we analyzed incoming support requests by the hour of the day. There is no surprise that 9am to 1pm US Eastern time is the busiest time of them all as emails from Europe and tickets from both East and West coast are coming in. We grouped those emails by the hour of the day and placed them on the world map with timezones for easy digesting. <\/p>\n<p><a href=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_timezones.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_timezones.png\" alt=\"\" width=\"904\" height=\"503\" class=\"alignnone size-full wp-image-2374\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_timezones.png 904w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_timezones-300x167.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_timezones-768x427.png 768w\" sizes=\"auto, (max-width: 904px) 100vw, 904px\" \/><\/a><br \/>\n<!--more--><\/p>\n<p>Here is the SQL query that we have used to pull and group data. Our local time is US Eastern Time (GMT +5) and we needed to adjust data in order to match it with timezones. This syntax applies to SQL Server. <\/p>\n<p>How this chart is useful? It tells you what hours are the most important from the customer service point of view and if you were to hire a new support person you need to make sure they can cover all the busiest timezones. <\/p>\n<pre name=\"code\" class=\"sql:nocontrols\">select\r\nDATEPART(HOUR, dateadd(hour,5,created)) AS [hour],\r\nCOUNT(*) AS [count]\r\nFROM dbo.tblEmail\r\nWHERE (direction = 1) AND (created > '2019-01-01 00:00:00')\r\nGROUP BY DATEPART(HOUR, dateadd(hour,5,created))\r\nORDER BY DATEPART(HOUR, dateadd(hour,5,created)) desc \r\n<\/pre>\n<p>And also here are chart settings. Here we add a background image, remove the padding between bars, set the Y-axis scale to about 50% so bars do not completely cover the map, and also make chart bars semi-transparent. This code goes to <strong>ChartModify<\/strong> event. <\/p>\n<pre name=\"code\" class=\"js:nocontrols\">\r\n\/\/ chart background\r\nchart.background().fill({\r\n  src: \"images\/timezones.png\",\r\n  mode: \"fit\"\r\n});\r\n\r\n\/\/ padding between bars\r\nchart.barGroupsPadding(0);\r\n\r\n\/\/ max scale to about 50% of the chart height\r\nchart.yScale().maximum(8000);\r\n\r\n\/\/ hide Y-axis\r\nchart.yAxis().enabled(false);\r\n\r\n\/\/ set series colors and transparency\r\nvar series1 = chart.getSeriesAt(0);\r\nseries1.normal().fill(\"#004499\", 0.2);\r\n<\/pre>\n<p>The second chart represents incoming emails by the day of the week. I was a bit surprised to see that Wednesday is the busiest day of the week. Go figure. <\/p>\n<p>How can you use this info? You probably noticed, that most of our newsletters come out Thursday around lunchtime. We feel that most people are done with most of their work for the week and are more likely to read something else. <\/p>\n<p><a href=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_dow.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_dow.png\" alt=\"\" width=\"902\" height=\"543\" class=\"alignnone size-full wp-image-2373\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_dow.png 902w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_dow-300x181.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2020\/12\/scr_emails_dow-768x462.png 768w\" sizes=\"auto, (max-width: 902px) 100vw, 902px\" \/><\/a><\/p>\n<p>And here is the SQL query we used to build this chart. All other chart settings are pretty much default ones. <\/p>\n<pre name=\"code\" class=\"sql:nocontrols\">\r\nselect\r\ndatepart(w, created) AS downumber,\r\nDATENAME(w, created) AS dow,\r\nCOUNT(*) AS [count]\r\nFROM dbo.tblEmail\r\nWHERE (direction = 1) AND (created > '2019-01-01 00:00:00')\r\nGROUP BY datepart(w, created), DATENAME(w, created)\r\nORDER BY datepart(w, created)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As web developers, we deal with large amounts of data every day. Sometimes it helps to sit back and take a closer look at the data in hand and see what data is trying to tell. Here, at Xlinesoft.com customer support is one of the most important parts of the business. We deal with a large number of emails and helpdesk tickets every day and, as a small weekend project, we decided to build a few charts to analyze those emails. We are sharing these&#8230;<span class=\"clearfix clearfix-post\"><\/span><a href=\"https:\/\/xlinesoft.com\/blog\/2020\/12\/08\/analyzing-incoming-emails\/\" class=\"more-link\">Continue Reading <span class=\"screen-reader-text\">&#8220;Analyzing incoming emails&#8221;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,1,8],"tags":[],"class_list":["post-2370","post","type-post","status-publish","format-standard","hentry","category-asp-net","category-php-category","category-tutorials"],"_links":{"self":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/2370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/comments?post=2370"}],"version-history":[{"count":12,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/2370\/revisions"}],"predecessor-version":[{"id":2384,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/2370\/revisions\/2384"}],"wp:attachment":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/media?parent=2370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/categories?post=2370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/tags?post=2370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}