投稿時間:2023-07-07 06:19:56 RSSフィード2023-07-07 06:00 分まとめ(20件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
海外TECH Ars Technica Musk’s X Corp. threatens to sue Meta over Twitter “copycat” Threads https://arstechnica.com/?p=1952029 threads 2023-07-06 20:27:13
海外TECH MakeUseOf How to Use the TEXTSPLIT Function in Microsoft Excel https://www.makeuseof.com/use-textsplit-function-microsoft-excel/ columns 2023-07-06 20:15:18
海外TECH DEV Community Building a Real-Time Analytics Dashboard with Next.js, Tinybird, and Tremor: A Comprehensive Guide https://dev.to/mfts/building-a-real-time-analytics-dashboard-with-nextjs-tinybird-and-tremor-a-comprehensive-guide-15k0 Building a Real Time Analytics Dashboard with Next js Tinybird and Tremor A Comprehensive Guide What you will find in this article Real time analytics have become a vital part of today s applications especially when it comes to understanding user behavior and improving your platform based on data driven insights Even more so if your users rely on your product to deliver them with insights In this post we are going to explore how we can create a real time analytics dashboard for page views using Tinybird Tremor so and Next js We will be using Tinybird for data ingestion and real time data analysis Tremor for data visualization and Next js for server side rendering Papermark the open source DocSend alternative Before we kick off let me introduce you to Papermark It s an open source project for securely sharing documents with built in real time page by page analytics powered by Tinybird and visualized by Tremor I would be absolutely thrilled if you could give us a star Don t forget to share your thoughts in the comments section ️ Setup the projectLet s set up our project environment We will be setting up a Next js app installing Tinybird CLI and configuring the needed services and tools Set up teaIt s a good idea to have a package manager handy like tea It ll handle your development environment and simplify your programming life sh lt curl OR using brewbrew install teaxyz pkgs tea clitea frees you to focus on your code as it takes care of installing python and pipenv which I m using to run tinybird cli node npm and any other packages you may need The best part is tea installs all packages in a dedicated directory default tea keeping your system files neat and tidy Set up Next js with TypeScript and TailwindcssWe will use create next app to generate a new Next js project We will also be using TypeScript and Tailwind CSS so make sure to select those options when prompted npx create next app you ll be asked the following promptsWhat is your project named my appWould you like to add TypeScript with this project Y N select Y for typescriptWould you like to use ESLint with this project Y N select Y for ESLintWould you like to use Tailwind CSS with this project Y N select Y for Tailwind CSSWould you like to use the src directory with this project Y N select N for src directoryWhat import alias would you like configured enter for import alias Install TinybirdTinybird s command line interface CLI helps us to manage data sources and pipes I m installing tinybird cli using pipenv which manages a virtual environment for my pip packages in our local environment Navigate to your Next js repocd my app Create a new virtual environment and install Tinybird CLI if you install tea in the previous step then tea will take care of installing pipenv and its dependenciespipenv install tinybird cli Activate the virtual environmentpipenv shell Configuring TinybirdHead over to tinybird co and create a free account You need to have a Tinybird account and an associated token You can get the token from your Tinybird s dashboard Authenticate with tinybird cli using your auth token when promptedtb authA tinyb file will be added to your repo s root No need to modify it However add it it to your gitignore file to avoid exposing your token echo tinyb gt gt gitignore Building the applicationNow that we have our setup in place we are ready to start building our application The main features we ll cover are Tinybird Pipes and DatasourcesPage View RecordingTremor Bar Chart Tinybird Pipes and DatasourceThe ability to programmatically configure pipes and datasources for Tinybird offers a significant advantage This flexibility enables us to treat our data infrastructure as code meaning that the entire configuration can be committed into a version control system For an open source project like Papermark this capability is highly beneficial It fosters transparency and collaboration as contributors can readily understand the data structure without any ambiguity We set up Tinybird pipes and datasource as follows mkdir p lib tinybird datasources endpoints DatasourcesThis is basically a versioned schema for page views This the only datasource we need for ingesting storing and reading analytics about page views Feel free to add remove fields lib tinybird datasources page views datasourceVERSION DESCRIPTION gt Page views are events when a user views a documentSCHEMA gt id String json id linkId String json linkId documentId String json documentId viewId String json viewId Unix timestamp time Int json time duration UInt json duration The page number pageNumber LowCardinality String json pageNumber country String json country city String json city region String json region latitude String json latitude longitude String json longitude ua String json ua browser String json browser browser version String json browser version engine String json engine engine version String json engine version os String json os os version String json os version device String json device device vendor String json device vendor device model String json device model cpu architecture String json cpu architecture bot UInt json bot referer String json referer referer url String json referer url ENGINE MergeTree ENGINE SORTING KEY linkId documentId viewId pageNumber time id PipesIn Tinybird a pipe is a series of transformations that are applied to your data These transformations could include anything from simple data cleaning operations to complex aggregations and analytics We have one versioned pipe also sometimes called endpoint to retrieve page view data This Tinybird pipe named endpoint calculates the average duration users spend on each page of a specific document within a defined timeframe and presents the results in ascending order by page number lib endpoints get average page duration pipeVERSION NODE endpointSQL gt SELECT pageNumber AVG duration AS avg duration FROM page views v WHERE documentId String documentId required True AND time gt Int since required True GROUP BY pageNumber ORDER BY pageNumber ASCNow that we have Tinybird datasources and pipes set up you need to push them to your Tinybird s account using the CLI Navigate to the directory containing your datasource and pipe filescd lib tinybird Push your files to Tinybirdtb push datasources datasource pipes pipe Typescript functionsLet s set up the appropriate typescript functions to actually send and retrieve data from Tinybird We are using zod and chronark s zod bird libraryThis function is for retrieving data from Tinybird lib tinybird pipes tsimport z from zod import Tinybird from chronark zod bird const tb new Tinybird token process env TINYBIRD TOKEN export const getTotalAvgPageDuration tb buildPipe pipe get total average page duration v parameters z object documentId z string since z number data z object pageNumber z string avg duration z number This function is for sending data to Tinybird lib tinybird publish tsimport z from zod import Tinybird from chronark zod bird const tb new Tinybird token process env TINYBIRD TOKEN export const publishPageView tb buildIngestEndpoint datasource page views v event z object id z string linkId z string documentId z string viewId z string time z number int duration z number int pageNumber z string country z string optional default Unknown city z string optional default Unknown region z string optional default Unknown latitude z string optional default Unknown longitude z string optional default Unknown ua z string optional default Unknown browser z string optional default Unknown browser version z string optional default Unknown engine z string optional default Unknown engine version z string optional default Unknown os z string optional default Unknown os version z string optional default Unknown device z string optional default Desktop device vendor z string optional default Unknown device model z string optional default Unknown cpu architecture z string optional default Unknown bot z boolean optional referer z string optional default direct referer url z string optional default direct Configure Auth Token for productionDon t forget to add TINYBIRD TOKEN to your env file It s advised that you create a token that has the minimum scope for your operations Read from specific pipeAppend to specific datasourceCongrats You successfully configured Tinybird and ready to move to the next Page View RecordingWe will capture the page view event in our PDFviewer component and publish it to our Tinybird s datasource Let s build an API function to send data to Tinybird every time a page is viewed pages api record view tsimport NextApiRequest NextApiResponse from next import publishPageView from lib tinybird import z from zod import v as uuidv from uuid Define the validation schemaconst bodyValidation z object id z string linkId z string documentId z string viewId z string time z number int duration z number int pageNumber z string export default async function handle req NextApiRequest res NextApiResponse We only allow POST requests if req method POST res status json message Method Not Allowed return const linkId documentId viewId duration pageNumber req body const time Date now in milliseconds const pageViewId uuidv const pageViewObject id pageViewId linkId documentId viewId time duration pageNumber pageNumber toString const result bodyValidation safeParse pageViewObject if result success return res status json error Invalid body result error message try await publishPageView result data res status json message View recorded catch error res status json message error as Error message And finally the PDFViewer component that sends the request components PDFViewer tsximport useState useEffect from react const PDFViewer gt const pageNumber setPageNumber useState lt number gt useEffect gt startTime Date now update the start time for the new page when component unmounts calculate duration and track page view return gt const endTime Date now const duration Math round endTime startTime trackPageView duration pageNumber monitor pageNumber for changes async function trackPageView duration number await fetch api record view method POST body JSON stringify linkId props linkId documentId props documentId viewId props viewId duration duration pageNumber pageNumber headers Content Type application json return Your PDF Viewer implementation export default PDFViewer Tremor Bar ChartLet s now create a bar chart to display the page views for each document We are using tremor so to build our beautiful dashboard Install tremor with their CLI npx tremor cli latest init components bar chart tsximport BarChart from tremor react const timeFormatter number gt const totalSeconds Math floor number const minutes Math floor totalSeconds const seconds Math round totalSeconds Adding zero padding if seconds less than const secondsFormatted seconds lt seconds seconds return minutes secondsFormatted export default function BarChartComponent data return lt BarChart className mt rounded tremor small data data index pageNumber categories Time spent per page colors gray valueFormatter timeFormatter yAxisWidth showGridLines false gt lib swr use stats tsimport useRouter from next router import useSWR from swr import getTotalAvgPageDuration from lib tinybird pipes export function useStats const router useRouter const id router query as id string const data error useSWR id gt getTotalAvgPageDuration documentId id since dedupingInterval return durationData data isLoading error amp amp data error pages document id tsximport useDocument from lib swr use document import useStats from lib swr use stats import BarChartComponent from components bar chart export default function DocumentPage const document error documentError useDocument const stats error statsError useStats if documentError handle document error if statsError handle stats error return lt gt lt main gt document amp amp lt header gt lt h gt document name lt h gt stats amp amp lt BarChartComponent data stats durationData gt lt header gt lt main gt lt gt Voila The Bar Chart with accurate page by page time ConclusionThat s it We ve built a real time analytics dashboard for page views using Tinybird Tremor and Next js While the example here is simple the same concepts can be expanded to handle any kind of analytics your app might need to perform Thank you for reading I m Marc an open source advocate I am building papermark io the open source alternative to DocSend with millisecond accurate page analytics Help me out If you found this article helpful and got to understand Tinybird and dashboarding with Tremor better I would be eternally grateful if you could give us a star And don t forget to share your thoughts in the comments ️ 2023-07-06 20:08:05
Apple AppleInsider - Frontpage News TSMC says China's raw material export restrictions won't hurt -- for now https://appleinsider.com/articles/23/07/06/tsmc-says-chinas-raw-material-export-restrictions-wont-hurt----for-now?utm_medium=rss TSMC says China x s raw material export restrictions won x t hurt for nowChina s government has moved forward with restricting exports on certain materials central to chip manufacture ーbut TSMC does not foresee this will impact production in the short term for Apple devices TSMCTensions between the United States and China continue with the two government bodies going back and forth with specific restrictions impacting businesses on both sides It s notable enough that major companies like TSMC are considering moving some of its operations to Japan hoping to avoid some potential blowback Read more 2023-07-06 20:19:51
海外科学 NYT > Science FDA Makes Alzheimer’s Drug Leqembi Widely Accessible https://www.nytimes.com/2023/07/06/health/alzheimers-leqembi-medicare.html accessiblethe 2023-07-06 20:55:01
海外科学 NYT > Science Heat Records Broken Across Earth https://www.nytimes.com/2023/07/06/climate/climate-change-record-heat.html across 2023-07-06 20:33:37
海外科学 NYT > Science The Titan Submersible Passengers’ Final Hours https://www.nytimes.com/2023/07/02/us/titan-submersible-passengers.html The Titan Submersible Passengers Final HoursFive voyagers climbed into the Titan submersible in hopes of joining the select few who have seen the wreck of the Titanic up close But within hours their text messages stopped coming 2023-07-06 20:11:32
ニュース BBC News - Home OceanGate: Owner of Titan submersible suspends exploration https://www.bbc.co.uk/news/world-us-canada-66124767?at_medium=RSS&at_campaign=KARANGA commercial 2023-07-06 20:01:24
ビジネス ダイヤモンド・オンライン - 新着記事 ゼルダ、マリオ絶好調の任天堂に3つの死角「ゲーム儲かりすぎ」が招く落とし穴 - 今週もナナメに考えた 鈴木貴博 https://diamond.jp/articles/-/325709 ゼルダ、マリオ絶好調の任天堂につの死角「ゲーム儲かりすぎ」が招く落とし穴今週もナナメに考えた鈴木貴博任天堂のビジネスが、絶好調です。 2023-07-07 05:30:00
ビジネス ダイヤモンド・オンライン - 新着記事 円安に拍車をかける金融政策の乖離、それでも中期的な「円高シナリオ」が不変の理由 - 政策・マーケットラボ https://diamond.jp/articles/-/325659 中央銀行 2023-07-07 05:20:00
ビジネス ダイヤモンド・オンライン - 新着記事 住友生命社長に聞く新営業施策の進捗、「バイタリティ体験版普及&ソニー生命との乗り合いに手応えあり」 - ダイヤモンド保険ラボ https://diamond.jp/articles/-/325708 vitality 2023-07-07 05:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 証券、銀行、ファンド…金融業界で最強の「資格の組み合わせ」は?ライバルに差をつけろ! - ChatGPTで激変!コスパ・タイパで選ぶ 最強の資格&副業&学び直し https://diamond.jp/articles/-/325366 chatgpt 2023-07-07 05:10:00
ビジネス ダイヤモンド・オンライン - 新着記事 ドイツのロシア移民、ウクライナ戦争で分断 - WSJ発 https://diamond.jp/articles/-/325796 移民 2023-07-07 05:09:00
ビジネス ダイヤモンド・オンライン - 新着記事 「部下の本音がわからない…」残念な上司に欠けている“必須スキル”とは? - 「40代で戦力外」にならない!新・仕事の鉄則 https://diamond.jp/articles/-/325502 鉄則 2023-07-07 05:05:00
ビジネス ダイヤモンド・オンライン - 新着記事 楽天モバイル黒字化は「最低でも5年必要」の衝撃試算!最強プラン導入後の壮絶シナリオ - 楽天 解体寸前 https://diamond.jp/articles/-/324985 携帯電話 2023-07-07 05:05:00
ビジネス 電通報 | 広告業界動向とマーケティングのコラム・ニュース 社会を変える「コレクティブインパクト」の担い手は誰か?~予算とノウハウで勝る大企業、目的とビジョンに集う草の根運動の差~ https://dentsu-ho.com/articles/8624 社会貢献 2023-07-07 06:00:00
ビジネス 電通報 | 広告業界動向とマーケティングのコラム・ニュース 生命体の柔軟性と組織論~福岡伸一氏・寄稿 https://dentsu-ho.com/articles/8585 福岡伸一 2023-07-07 06:00:00
ビジネス 東洋経済オンライン 東大生実践「説明上手な人」の真似したい3つの技 聞き手にわかりやすく伝えるにはどうする? | リーダーシップ・教養・資格・スキル | 東洋経済オンライン https://toyokeizai.net/articles/-/684228?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2023-07-07 05:50:00
ビジネス 東洋経済オンライン ボーナス時に「つみたて投資」増やす人の落とし穴 これから始める人は「新NISA」まで待ったほうがいい? | 「お金で損しない」森永康平のマネーリテラシー講座 | 東洋経済オンライン https://toyokeizai.net/articles/-/684478?utm_source=rss&utm_medium=http&utm_campaign=link_back 国家公務員 2023-07-07 05:30:00
ビジネス 東洋経済オンライン 「子どもに言っても効果なし!」意外なNGワード10 「伝説の家庭教師」が"奇跡の言い換え"も紹介! | リーダーシップ・教養・資格・スキル | 東洋経済オンライン https://toyokeizai.net/articles/-/684085?utm_source=rss&utm_medium=http&utm_campaign=link_back 上場企業 2023-07-07 05:30:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)