<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: WalkerJS</title>
    <description>The latest articles on Forem by WalkerJS (@walkerjs).</description>
    <link>https://forem.com/walkerjs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F6214%2Fcb84d561-3862-4843-9f72-4403220aacdb.png</url>
      <title>Forem: WalkerJS</title>
      <link>https://forem.com/walkerjs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/walkerjs"/>
    <language>en</language>
    <item>
      <title>Webflow + Walker.js</title>
      <dc:creator>Ayla Prinz</dc:creator>
      <pubDate>Thu, 24 Nov 2022 10:51:17 +0000</pubDate>
      <link>https://forem.com/walkerjs/webflow-walkerjs-1oml</link>
      <guid>https://forem.com/walkerjs/webflow-walkerjs-1oml</guid>
      <description>&lt;p&gt;&lt;em&gt;The perfect match when it comes to tracking events for Google Tag Manager in Webflow.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To track user behavior on a Webflow site, the typical options involve manually coded dataLayer scripts with custom HTML on each page or using CSS selectors via the Google Tag Manager interface. If neither of these really work for you, try using walker.js for user behavior tracking based solely on &lt;strong&gt;custom attributes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Walker.js is a light-weight JavaScript library for capturing first-party user behavior data &lt;strong&gt;directly in HTML markup&lt;/strong&gt;. It offers the developer’s experience and flexibility of big analytics libraries like Segment's analytics.js but, crucially, remains much simpler than it through a &lt;strong&gt;declarative approach&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Walker.js code lives directly in element attributes, and that makes it a perfect fit for Webflow sites.&lt;/p&gt;

&lt;p&gt;So, how can you integrate and use walker.js in Webflow?&lt;/p&gt;

&lt;h1&gt;
  
  
  Initializing walker.js
&lt;/h1&gt;

&lt;p&gt;To initialize walker.js in Webflow, include the following script tag in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; element globally in Project Settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;async&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"elbwalker"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/@elbwalker/walker.js@latest/dist/walker.js"&lt;/span&gt; &lt;span class="na"&gt;data-default=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please refer to the Webflow docs article “&lt;a href="https://university.webflow.com/lesson/custom-code-in-the-head-and-body-tags" rel="noopener noreferrer"&gt;How to add custom code to Webflow&lt;/a&gt;” to learn more about custom code in Webflow.&lt;/p&gt;

&lt;h1&gt;
  
  
  Adding elb-tags via custom attributes
&lt;/h1&gt;

&lt;p&gt;Walker.js events are declared as custom element attributes. To add a custom attribute to an element in Webflow Designer go to the Element Settings tab and click the plus icon on the custom attributes panel:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.loom.com/share/7f04035b7cfd4e4e94dd5b87dd2eaa19" rel="noopener noreferrer"&gt;&lt;br&gt;
    &lt;p&gt;Add custom attributes in Webflow - Watch Video&lt;/p&gt;
&lt;br&gt;
    &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2F7f04035b7cfd4e4e94dd5b87dd2eaa19-1669129520380-with-play.gif" width="576" height="360"&gt;&lt;br&gt;
  &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, custom attributes will be described as follows:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;data-elb="ENTITY"&lt;br&gt;
  data-elb-ENTITY="KEY:VALUE"&lt;br&gt;
  data-elbaction="TRIGGER:ACTION"&lt;br&gt;
  data-elbglobals="KEY:VALUE"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;which corresponds to the following settings in Webflow Designer:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33bfegt38yle60lrghcg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33bfegt38yle60lrghcg.png" alt="elb-attributes in Webflow" width="475" height="346"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Walker.js example: tagging banner engagement
&lt;/h1&gt;

&lt;p&gt;In this short tutorial, say you want to track the engagement of a user with a promotion banner using walker.js.&lt;/p&gt;

&lt;p&gt;We want to measure how often the promotion banner has been visible to your users. How many times the "Get started"-button got hovered over and how many clicks happened on both the "Get started" and "book demo"-button. &lt;/p&gt;
&lt;h3&gt;
  
  
  Setting the scope and properties of the banner
&lt;/h3&gt;

&lt;p&gt;To set the scope of what element we want to track the first thing we do is set the entity.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;data-elb="banner"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We also want to add a property that further describes the entity e.g. title or the headline we used. This way we can later test different titles against each other for example.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;data-elb-banner="title:Example Banner"&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Measure visibility of the banner
&lt;/h3&gt;

&lt;p&gt;Add the action attribute and use the trigger &lt;code&gt;visible&lt;/code&gt; which fires the view event after the element has been in the user's viewport for at least 50% for one second.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;data-elbaction="visible:view"&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
The config should look like this at this point:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb5g05l8ri7k72jypbbq2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb5g05l8ri7k72jypbbq2.png" alt="Config of custom elb-attributes in Webflow" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Measure mouse hover &amp;amp; click events
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;data-elbaction="hover;click:start"&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3taqormv55sm8rsllm8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk3taqormv55sm8rsllm8.png" alt="Config of custom elb-attributes in Webflow clicks and hover" width="800" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;data-elbaction="click:demo"&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxuncvysh4x4yb17naawh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxuncvysh4x4yb17naawh.png" alt="Config of custom elb-attributes in Webflow clicks" width="800" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are many more prebuilt triggers like pulse, load, and wait  ...&lt;a href="https://docs.elbwalker.com/tagging/available-triggers" rel="noopener noreferrer"&gt;See the full list&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Set global attributes to every user interaction
&lt;/h3&gt;

&lt;p&gt;Global attributes give more context to the data. Setting an elb-global attribute for page types e.g. helps to differentiate between the same events happening on different page types. We used the home and features type in this example. Global attributes can simply be added e.g. to the &lt;code&gt;body div&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;data-elbglobals="pagetype:home"&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;code&gt;data-elbglobals="pagetype:features"&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F007ebsxgkehgnokgrpe6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F007ebsxgkehgnokgrpe6.png" alt="Custom global elb-attributes in Webflow" width="800" height="117"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Debugging in the console
&lt;/h1&gt;

&lt;p&gt;To be able to debug the implementation in the console we’ll add the “console destination” in the custom code settings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;elb&lt;/span&gt;&lt;span class="p"&gt;(){(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;elbLayer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;elbLayer&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[]).&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;);}&lt;/span&gt;
&lt;span class="nf"&gt;elb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;walker destination&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.loom.com/share/0b9048f512c449158e5e9ffcaa669000" rel="noopener noreferrer"&gt;&lt;br&gt;
    &lt;p&gt;Testing walker.js implementation in Webflow - Watch Video&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
    &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2F0b9048f512c449158e5e9ffcaa669000-1669130359847-with-play.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2F0b9048f512c449158e5e9ffcaa669000-1669130359847-with-play.gif" width="576" height="360"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
  &lt;/p&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;There you have it — walker.js in Webflow!&lt;/p&gt;

&lt;p&gt;By having full events in the dataLayer you can further use them in Google Tag Manager. You can e.g. use them as events for Google Analytics 4 or as conversion events for the Meta pixel.&lt;/p&gt;

&lt;p&gt;This is just the beginning of a small Webflow series — please let me know what user interactions you want to measure with walker.js in Webflow.&lt;/p&gt;

&lt;p&gt;Links:&lt;/p&gt;

&lt;p&gt;Documentation: &lt;a href="https://docs.elbwalker.com" rel="noopener noreferrer"&gt;https://docs.elbwalker.com&lt;/a&gt;&lt;br&gt;
More examples: &lt;a href="https://www.elbwalker.com/gallery" rel="noopener noreferrer"&gt;https://www.elbwalker.com/gallery&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a href="https://github.com/elbwalker/walker.js" rel="noopener noreferrer"&gt;https://github.com/elbwalker/walker.js&lt;/a&gt;&lt;br&gt;
LinkedIn: &lt;a href="https://linkedin.com/elbwalker" rel="noopener noreferrer"&gt;https://linkedin.com/elbwalker&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The entity-action event concept</title>
      <dc:creator>alexander</dc:creator>
      <pubDate>Wed, 26 Oct 2022 15:21:40 +0000</pubDate>
      <link>https://forem.com/walkerjs/the-entity-action-event-concept-12ha</link>
      <guid>https://forem.com/walkerjs/the-entity-action-event-concept-12ha</guid>
      <description>&lt;h2&gt;
  
  
  Where we are coming from
&lt;/h2&gt;

&lt;p&gt;We, as well as many other data professionals out there, grew up with still the most common event out there: the &lt;strong&gt;pageview&lt;/strong&gt; - the mother of all tracking events for over a decade. Over the years new events, mostly to track online shopping behavior, became the new normal and the concept of the traditional purchase conversion was born. With the rising importance of mobile apps (where there is no such thing as a pageview), event tracking evolved immensely. And today it's not only about online shopping anymore. &lt;strong&gt;But events and event-based tracking came to stay&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We believe that tracking shouldn't sound like some abstract techy abbreviation concept. It should feel natural and &lt;strong&gt;everyone in an organization should immediately understand it&lt;/strong&gt; no matter if they implemented the tracking or not. Only when everyone understands what is being measured, there will be fewer misunderstandings, higher data quality, and more actionable data in the organization at the end of the day.&lt;/p&gt;

&lt;h2&gt;
  
  
  elbwalker's approach to the concept of an event
&lt;/h2&gt;

&lt;p&gt;A lot of languages are based on some kind of &lt;strong&gt;subject, predicate, object structure&lt;/strong&gt;. It is the general rule for understanding this sentence right here (which may drove some of us insane at school). At elbwalker, we asked ourselves how we can evolve a simple pageview to a more natural concept.&lt;/p&gt;

&lt;p&gt;Let us introduce: the &lt;strong&gt;page view&lt;/strong&gt; (notice the space!). A small change with a huuuge impact.&lt;/p&gt;

&lt;p&gt;Doesn't look very different to you? Well, let us explain why it is.&lt;/p&gt;

&lt;p&gt;Tracking starts with a user interaction that triggers something. Whether it is something implicit, e.g. loading, scrolling, waiting, or something explicit, e.g. clicking a specific button right at this moment. We treat the user, who e.g. is loading something, as the subject. The page (context) is the object and the action "view" is basically the predicate.&lt;/p&gt;

&lt;h2&gt;
  
  
  A user views a page by loading it → page view.
&lt;/h2&gt;

&lt;p&gt;Since we want to evolve the classic, static concept of an event &lt;strong&gt;we split the action (view) from the object (page)&lt;/strong&gt;. Just because there are so many more possibilities that can be done with the same object.&lt;/p&gt;

&lt;p&gt;To sum up: &lt;strong&gt;an elbwalker event consists of three components: a trigger (load), an entity (page), and an action (view)&lt;/strong&gt;. Now we're free to do a lot of great things! So let's get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  How this concept makes your life in measurement much easier
&lt;/h2&gt;

&lt;p&gt;It's nice to know that a page view has happened, but we also want to know which page exactly had that view. Also, the information &lt;em&gt;click&lt;/em&gt; isn't worth a lot, if we don't know what exactly has been clicked by someone. We need to &lt;strong&gt;know the context&lt;/strong&gt; to know that it was the add to cart button of a specific product in a specific size. Most of the time, the more context, the better.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Context creates meaning. Context is queen and king.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;An elbwalker entity is defining the scope to create a specific context. Inside this entity scope, all actions are to be defined. As a data person, I want to know which product someone added to the cart. As a data person, I want to know which page someone viewed. And so on. To capture this information you can add properties to an elbwalker event. You will likely know this from e.g. Google Analytics 4 implementations.&lt;/p&gt;

&lt;p&gt;There are endless possibilities of what someone can do on a page. There is no need to just focus on the view, and create weird concepts like bounce rates. Let's move on and measure the read action in addition to the view action of a page. And how about measuring the user's feedback like the like action or share action? Imagine all the new possibilities we can now analyze and report and how we can personalize and optimize based on the context of a page.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Entity&lt;/th&gt;
&lt;th&gt;Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;page&lt;/td&gt;
&lt;td&gt;view, read, like, share&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;product&lt;/td&gt;
&lt;td&gt;view, interest, like, add&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We've built the open-sourced &lt;a href="https://github.com/elbwalker/walker.js"&gt;walker.js&lt;/a&gt; to support this new approach of event tracking. The combination of an attributed-based tracker and the new event concept makes tracking implementation &lt;strong&gt;easy, fast, and reliable&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>concept</category>
      <category>data</category>
    </item>
  </channel>
</rss>
