{"id":3938,"date":"2014-03-03T17:15:32","date_gmt":"2014-03-03T17:15:32","guid":{"rendered":"https:\/\/www.gosquared.com\/blog\/?p=3938"},"modified":"2019-11-28T12:17:58","modified_gmt":"2019-11-28T12:17:58","slug":"show-popular-content-on-your-site","status":"publish","type":"post","link":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site","title":{"rendered":"How To: Show Popular Content on your Site"},"content":{"rendered":"<p><iframe height=\"270\" src=\"https:\/\/snippets.gosquared.com\/top-content\/final\/result.html\"><\/iframe><\/p>\n<p dir=\"ltr\">Displaying trending content is a great feature for any website, especially for publishers and <a href=\"https:\/\/www.gosquared.com\/software\/ecommerce\/\">ecommerce stores<\/a>.<\/p>\n<p dir=\"ltr\">Why? Because it is one the best ways to keep visitors engaged on your site with content that resonates with the audience right at that very moment.<\/p>\n<p dir=\"ltr\">There are already a few widgets\/tools that can provide top content lists but they often have a long lag time &#8211; sometimes over 24 hours. This means trending content won\u2019t be as relevant and therefore makes the widget less effective.<\/p>\n<p>With the <a href=\"https:\/\/gosquared.com\/developer\/api\" target=\"_blank\" rel=\"noopener noreferrer\">GoSquared API<\/a>, you can use our real-time analytics to show what is really trending on your site right now. This means better content for your audience and considerably better metrics for your site.<\/p>\n<p>Adding a simple real-time list to display your Top Content is easy . Our friends at <a href=\"http:\/\/www.carthrottle.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">CarThrottle<\/a> have a great implementation, with the list embedded in their sidebar and updating with animations in real-time.<\/p>\n<p>This tutorial will show you how to implement a similar top content widget, as well as advice on best practices while using the GoSquared API publicly.<\/p>\n<div id=\"attachment_3989\" style=\"width: 310px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3989\" class=\"size-medium wp-image-3989\" alt=\"Car Throttle Top Content using GoSquared API\" src=\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59-300x273.png\" width=\"300\" height=\"273\" srcset=\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59-300x273.png 300w, https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59.png 525w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><p id=\"caption-attachment-3989\" class=\"wp-caption-text\">Car Throttle&#8217;s Top Content powered by the GoSquared API<\/p><\/div>\n<p><em>Note: this tutorial requires jQuery!<\/em><\/p>\n<h2>The basics<\/h2>\n<p>Getting the data and displaying a list is easy and can be done using the following code.<\/p>\n<p><iframe loading=\"lazy\" class=\"snippet\" src=\"https:\/\/snippets.gosquared.com\/top-content\/basic\/\" height=\"270\" width=\"100%\"><\/iframe><\/p>\n<p>We strongly recommend using a simple proxy to get the API data so your API key isn&#8217;t exposed publicly and using a cache so you won&#8217;t hit your API limits if you have a lot of visitors.<\/p>\n<h2>Updating on an interval<\/h2>\n<p>Showing a basic list is great, but GoSquared provides accurate real-time information, so why not update the list every 5 seconds to make it more engaging and interactive?<\/p>\n<p><iframe loading=\"lazy\" class=\"snippet\" src=\"https:\/\/snippets.gosquared.com\/top-content\/interval\/\" height=\"270\" width=\"100%\"><\/iframe><\/p>\n<h2>Animating the updates<\/h2>\n<p>A list that updates every 5 seconds is great, but we can do a lot better than that. Let&#8217;s animate the changes to make everything feel smoother and give users a better idea of what&#8217;s trending.<\/p>\n<p><iframe loading=\"lazy\" class=\"snippet\" src=\"https:\/\/snippets.gosquared.com\/top-content\/animating\/\" height=\"270\" width=\"100%\"><\/iframe><\/p>\n<h2>Finishing Touches<\/h2>\n<p>Let&#8217;s also display the real-time visitor numbers for each page and animate them as they change too. If you don&#8217;t want to reveal visitor numbers, you could process the data to get a trending rating (e.g. % of total visitors currently on that page).<\/p>\n<p><iframe loading=\"lazy\" class=\"snippet\" src=\"https:\/\/snippets.gosquared.com\/top-content\/final\/\" height=\"330\" width=\"100%\"><\/iframe><\/p>\n<p>And there you have it, popular content displayed on your website in a lovely widget. Want to build one yourself? Take a look at the <a href=\"https:\/\/gosquared.com\/developer\/api\/now\/v3\/pages\" target=\"_blank\" rel=\"noopener noreferrer\">Pages API Documentation<\/a>.<\/p>\n<p>Questions? Comments? Get in touch with us via <a href=\"https:\/\/twitter.com\/gosquared\" target=\"_blank\" rel=\"noopener noreferrer\">Twitter<\/a>, <a href=\"https:\/\/facebook.com\/gosquared\" target=\"_blank\" rel=\"noopener noreferrer\">Facebook<\/a> or, of course, <a href=\"https:\/\/www.gosquared.com\/support\/emails\/new\" target=\"_blank\" rel=\"noopener noreferrer\">email<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p dir=\"ltr\">Displaying trending content is a great feature for any website, especially for publishers and ecommerce stores.<\/p>\n<p dir=\"ltr\">Why? Because it is one the best ways to keep visitors engaged on your site with content that resonates with the audience right at that very moment.<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1587],"tags":[101,271,750,961],"class_list":["post-3938","post","type-post","status-publish","format-standard","hentry","category-product-design","tag-api","tag-developer","tag-real-time","tag-web"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.6 (Yoast SEO v19.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To: Show Popular Content on your Site - GoSquared Blog<\/title>\n<meta name=\"description\" content=\"Show popular &amp; trending content on your site using GoSquared&#039;s real-time analytics. Engage with visitors by displaying the top pages in real-time.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To: Show Popular Content on your Site\" \/>\n<meta property=\"og:description\" content=\"Show popular &amp; trending content on your site using GoSquared&#039;s real-time analytics. Engage with visitors by displaying the top pages in real-time.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site\" \/>\n<meta property=\"og:site_name\" content=\"GoSquared Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GoSquared\" \/>\n<meta property=\"article:published_time\" content=\"2014-03-03T17:15:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-28T12:17:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59-300x273.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@simon_tabor\" \/>\n<meta name=\"twitter:site\" content=\"@GoSquared\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Simon Tabor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#organization\",\"name\":\"GoSquared\",\"url\":\"https:\/\/www.gosquared.com\/blog\/\",\"sameAs\":[\"https:\/\/instagram.com\/gosquaredteam\",\"https:\/\/www.linkedin.com\/company\/go-squared-ltd.\",\"https:\/\/www.facebook.com\/GoSquared\",\"https:\/\/twitter.com\/GoSquared\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png\",\"contentUrl\":\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png\",\"width\":1270,\"height\":250,\"caption\":\"GoSquared\"},\"image\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#website\",\"url\":\"https:\/\/www.gosquared.com\/blog\/\",\"name\":\"GoSquared Blog\",\"description\":\"Turn visitors into customers.\",\"publisher\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.gosquared.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#primaryimage\",\"url\":\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59.png\",\"contentUrl\":\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59.png\",\"width\":525,\"height\":478},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#webpage\",\"url\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site\",\"name\":\"How To: Show Popular Content on your Site - GoSquared Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#primaryimage\"},\"datePublished\":\"2014-03-03T17:15:32+00:00\",\"dateModified\":\"2019-11-28T12:17:58+00:00\",\"description\":\"Show popular & trending content on your site using GoSquared's real-time analytics. Engage with visitors by displaying the top pages in real-time.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.gosquared.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To: Show Popular Content on your Site\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#webpage\"},\"author\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/71fad71f60ad33cf9356687b37aed3d0\"},\"headline\":\"How To: Show Popular Content on your Site\",\"datePublished\":\"2014-03-03T17:15:32+00:00\",\"dateModified\":\"2019-11-28T12:17:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#webpage\"},\"wordCount\":420,\"publisher\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59-300x273.png\",\"keywords\":[\"API\",\"Developer\",\"Real-Time\",\"Web\"],\"articleSection\":[\"Product Design\"],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/71fad71f60ad33cf9356687b37aed3d0\",\"name\":\"Simon Tabor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dc920e48608646bda51d2e6e2595e8ad926cff52eba534c1d25fb1618f15b59f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dc920e48608646bda51d2e6e2595e8ad926cff52eba534c1d25fb1618f15b59f?s=96&d=mm&r=g\",\"caption\":\"Simon Tabor\"},\"description\":\"Lead developer at GoSquared for integrations, partnerships and the API. Works on pretty much everything.\",\"sameAs\":[\"http:\/\/simontabor.com\",\"https:\/\/twitter.com\/simon_tabor\"],\"url\":\"https:\/\/www.gosquared.com\/blog\/author\/simontabor\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To: Show Popular Content on your Site - GoSquared Blog","description":"Show popular & trending content on your site using GoSquared's real-time analytics. Engage with visitors by displaying the top pages in real-time.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site","og_locale":"en_US","og_type":"article","og_title":"How To: Show Popular Content on your Site","og_description":"Show popular & trending content on your site using GoSquared's real-time analytics. Engage with visitors by displaying the top pages in real-time.","og_url":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site","og_site_name":"GoSquared Blog","article_publisher":"https:\/\/www.facebook.com\/GoSquared","article_published_time":"2014-03-03T17:15:32+00:00","article_modified_time":"2019-11-28T12:17:58+00:00","og_image":[{"url":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59-300x273.png"}],"twitter_card":"summary_large_image","twitter_creator":"@simon_tabor","twitter_site":"@GoSquared","twitter_misc":{"Written by":"Simon Tabor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/www.gosquared.com\/blog\/#organization","name":"GoSquared","url":"https:\/\/www.gosquared.com\/blog\/","sameAs":["https:\/\/instagram.com\/gosquaredteam","https:\/\/www.linkedin.com\/company\/go-squared-ltd.","https:\/\/www.facebook.com\/GoSquared","https:\/\/twitter.com\/GoSquared"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png","contentUrl":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png","width":1270,"height":250,"caption":"GoSquared"},"image":{"@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/www.gosquared.com\/blog\/#website","url":"https:\/\/www.gosquared.com\/blog\/","name":"GoSquared Blog","description":"Turn visitors into customers.","publisher":{"@id":"https:\/\/www.gosquared.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gosquared.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#primaryimage","url":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59.png","contentUrl":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59.png","width":525,"height":478},{"@type":"WebPage","@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#webpage","url":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site","name":"How To: Show Popular Content on your Site - GoSquared Blog","isPartOf":{"@id":"https:\/\/www.gosquared.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#primaryimage"},"datePublished":"2014-03-03T17:15:32+00:00","dateModified":"2019-11-28T12:17:58+00:00","description":"Show popular & trending content on your site using GoSquared's real-time analytics. Engage with visitors by displaying the top pages in real-time.","breadcrumb":{"@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gosquared.com\/blog"},{"@type":"ListItem","position":2,"name":"How To: Show Popular Content on your Site"}]},{"@type":"Article","@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#article","isPartOf":{"@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#webpage"},"author":{"@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/71fad71f60ad33cf9356687b37aed3d0"},"headline":"How To: Show Popular Content on your Site","datePublished":"2014-03-03T17:15:32+00:00","dateModified":"2019-11-28T12:17:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#webpage"},"wordCount":420,"publisher":{"@id":"https:\/\/www.gosquared.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.gosquared.com\/blog\/show-popular-content-on-your-site#primaryimage"},"thumbnailUrl":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2013\/07\/Screen-Shot-2013-07-16-at-15.47.59-300x273.png","keywords":["API","Developer","Real-Time","Web"],"articleSection":["Product Design"],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/71fad71f60ad33cf9356687b37aed3d0","name":"Simon Tabor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/dc920e48608646bda51d2e6e2595e8ad926cff52eba534c1d25fb1618f15b59f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc920e48608646bda51d2e6e2595e8ad926cff52eba534c1d25fb1618f15b59f?s=96&d=mm&r=g","caption":"Simon Tabor"},"description":"Lead developer at GoSquared for integrations, partnerships and the API. Works on pretty much everything.","sameAs":["http:\/\/simontabor.com","https:\/\/twitter.com\/simon_tabor"],"url":"https:\/\/www.gosquared.com\/blog\/author\/simontabor"}]}},"wps_subtitle":"GoSquared API to the rescue","_links":{"self":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/posts\/3938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/comments?post=3938"}],"version-history":[{"count":0,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/posts\/3938\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/media?parent=3938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/categories?post=3938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/tags?post=3938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}