{"id":85,"date":"2022-11-29T06:47:57","date_gmt":"2022-11-29T06:47:57","guid":{"rendered":"https:\/\/superpwa.com\/documentation\/?post_type=ht_kb&#038;p=85"},"modified":"2025-12-17T05:25:06","modified_gmt":"2025-12-17T05:25:06","slug":"offline-analytics-in-super-pwa","status":"publish","type":"ht_kb","link":"https:\/\/superpwa.com\/docs\/article\/offline-analytics-in-super-pwa\/","title":{"rendered":"Offline Analytics in SuperPWA"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">So you\u2019ve got a progressive web app, complete with a service worker that allows it to work offline. You\u2019ve also got existing Google Analytics set up for your web app, and you don\u2019t want to miss out on any analytical insights coming from usage that occurs while offline.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But if you try to send data to Google Analytics while offline, those requests will fail and the data will be lost. It\u2019s adding code to your service worker to store Google Analytics requests and retry them later when there\u2019s hopefully a network available.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>For the solution of this situation we created an option as follows:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1:&nbsp;<\/strong>First thing you need to do is to install and activate the&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/super-progressive-web-apps\/\">SuperPWA<\/a>&nbsp;plugin.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<\/strong>&nbsp;After installing the plugin in the dashboard, You will find this option in&nbsp;<strong>WordPress Dashboard<\/strong>&nbsp;-&gt; Navigate to&nbsp;<strong>SuperPWA<\/strong>&nbsp;option -&gt;&nbsp;<strong>Settings<\/strong>&nbsp;-&gt;&nbsp;<strong>Advanced&nbsp;<\/strong>-&gt; Check this &#8220;<strong>Offline analytics<\/strong>&#8221;&nbsp;option like below the screenshot.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/superpwa.com\/wp-content\/uploads\/2021\/07\/4.png\" alt=\"4\" class=\"wp-image-5564\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Offline Analytics:<\/strong>&nbsp;Offline analytics is a module that will use background sync to ensure that requests to Google Analytics are made regardless of the current network condition.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3:<\/strong>&nbsp;Click on the \u201c<strong>Save Settings<\/strong>\u201d button<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>That\u2019s it for this tutorial!<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We hope we\u2019ve clear your doubts in case If you have any feedback or questions, Just contact us&nbsp;<strong><a href=\"https:\/\/superpwa.com\/contact\/\">here<\/a>&nbsp;<\/strong>and&nbsp;we are always available for you<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you\u2019ve got a progressive web app, complete with a service worker that allows it to work offline. You\u2019ve also got existing Google Analytics set up for your web app, and you don\u2019t want to miss out on any analytical insights coming from usage that occurs while offline. But if&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[2],"ht-kb-tag":[],"class_list":["post-85","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-getting-started"],"_links":{"self":[{"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/ht-kb\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":2,"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/ht-kb\/85\/revisions"}],"predecessor-version":[{"id":667,"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/ht-kb\/85\/revisions\/667"}],"wp:attachment":[{"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/ht-kb-category?post=85"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/superpwa.com\/docs\/wp-json\/wp\/v2\/ht-kb-tag?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}