<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Posts tagged #hopscotch</title><description>The latest posts tagged with hopscotch on queen.raae.codes</description><link>https://queen.raae.codes/tag/hopscotch/</link><item><title>💬 💬 ~ Using the Gatsby Script component to add a Hopscotch tour</title><link>https://queen.raae.codes/2022-10-14-script-component-hopscotch/</link><guid isPermaLink="true">https://queen.raae.codes/2022-10-14-script-component-hopscotch/</guid><description>Yesterday, we added an onboarding tour to &quot;Prune your follows&quot; together with Cam Sloan of Hopscotch unauthorized and rum-fueled treasure hunt in the sharky…</description><pubDate>Fri, 14 Oct 2022 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Yesterday, we added an onboarding tour to &amp;quot;Prune your follows&amp;quot; together with Cam Sloan of Hopscotch &lt;a href=&quot;https://youtu.be/yDxF8FUNUbI&quot;&gt;unauthorized and rum-fueled treasure hunt&lt;/a&gt; in the sharky waters around the Gatsby islands 🏴‍☠️&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://youtu.be/yDxF8FUNUbI&quot;&gt;&lt;img src=&quot;screengrab-show.jpg&quot; alt=&quot;Screengrab from the show&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To do so, we needed to add an external script. Since I wrote about &lt;a href=&quot;/2022-01-05-external-scripts/&quot;&gt;Third party scripts with Gatsby&lt;/a&gt; back in January, Gatsby has added a new way: the &lt;a href=&quot;https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-script/&quot;&gt;&lt;code&gt;Script&lt;/code&gt; component&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It can be used to add both inline scripts and external scripts.&lt;/p&gt;
&lt;p&gt;Hopscotch provides us with an inline script:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&amp;lt;script id=&amp;quot;hopscotch-script&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;(function (w, d) {if (typeof w === &amp;quot;undefined&amp;quot;) return;w.Hopscotch = w.Hopscotch || function () {(w.Hopscotch.q = w.Hopscotch.q || []).push(arguments);};var elm = d.createElement(&amp;quot;div&amp;quot;);elm.setAttribute(&amp;quot;data-widget-host&amp;quot;, &amp;quot;hopscotch&amp;quot;);elm.setAttribute(&amp;quot;data-props-api-key&amp;quot;, &amp;quot;39311cf6-d7b7-5e00-b8e7&amp;quot;);d.getElementsByTagName(&amp;quot;body&amp;quot;)[0].appendChild(elm);var s = d.createElement(&amp;quot;script&amp;quot;);s.src = &amp;quot;https://widgets.hopscotch.club/v1/widget.js?&amp;quot;;s.async = 1;s.defer = 1;d.getElementsByTagName(&amp;quot;body&amp;quot;)[0].appendChild(s);  })(window, document);&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To make it work as a &lt;code&gt;Script&lt;/code&gt; component, we had to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Exchange &lt;code&gt;script&lt;/code&gt; for &lt;code&gt;Script&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Make the inline code a &amp;quot;template literal&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&amp;lt;Script
  id=&amp;quot;hopscotch-script&amp;quot;
  type=&amp;quot;text/javascript&amp;quot;
&amp;gt;{`(function (w, d) {if (typeof w === &amp;quot;undefined&amp;quot;) return;w.Hopscotch = w.Hopscotch || function () {(w.Hopscotch.q = w.Hopscotch.q || []).push(arguments);};var elm = d.createElement(&amp;quot;div&amp;quot;);elm.setAttribute(&amp;quot;data-widget-host&amp;quot;, &amp;quot;hopscotch&amp;quot;);elm.setAttribute(&amp;quot;data-props-api-key&amp;quot;, &amp;quot;39311cf6-d7b7-5e00-b8e7&amp;quot;);d.getElementsByTagName(&amp;quot;body&amp;quot;)[0].appendChild(elm);var s = d.createElement(&amp;quot;script&amp;quot;);s.src = &amp;quot;https://widgets.hopscotch.club/v1/widget.js?&amp;quot;;s.async = 1;s.defer = 1;d.getElementsByTagName(&amp;quot;body&amp;quot;)[0].appendChild(s);  })(window, document);`}&amp;lt;/Script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After that, we set up the tour in Hopscotch 🎉&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;./product-tour.jpg&quot; alt=&quot;Screengrab of product tour&quot;&gt;&lt;/p&gt;
&lt;p&gt;I think the whole thing took us less than 15 minutes, but we managed to stream for a full hour anyhow: chatting, testing things out, and meeting Cam&apos;s dog 🤪&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;All the best,&lt;br&gt;
Queen Raae&lt;/p&gt;
</content:encoded></item></channel></rss>