Utilities

Google Event Tracking

So you want to be able to track events inside of analytics (GA4) and tag manager, we have created this simple script. You will need to add a class of actionButton and then set the attributes.

data-name  : can be descriptive to the action
data-location : is where on the page did the event happen use hyphens to separate spaces

If using CMS connect data name to the slug.


Paste the code in your page settings custom code in the before </body> tag

The requested data is captured and stored in the window.dataLayer and can be access in GTM.

Setting up GTM

1. Create a Data Layer Variable for buttonName and buttonLocation
2. Create an associated Custom Event Trigger with the name "Action Button Click" with event name "event_button"
3. Create a new GA4 event tag add your measurement ID with the relevant parameters using the Data Layer Variable and assign the trigger created in step 2.

Refer to the Google Tag Manager documentation for detailed instructions on creating variables, triggers, and tags.
Class type
Copy
content_copy
Copied
<script>
document.addEventListener('DOMContentLoaded', function() {
 // Select all elements with the class 'actionbutton'
 let actionButtons = document.querySelectorAll('.actionbutton');  // Create trackClick event to capture name and location
 function trackClick(event, button) {
   event.preventDefault();  // Prevent the default link behavior    
let name = button.getAttribute('data-name');
   let location = button.getAttribute('data-location');
   let href = button.getAttribute('href');  // Get the link's href value    // Log the values for debugging
   console.log('Tracking button click:', name, location);    // Push to dataLayer with just the necessary data
   window.dataLayer = window.dataLayer || [];
   window.dataLayer.push({
     event: 'event_button',
     buttonName: name,
     buttonLocation: location
   });    console.log('Data Layer pushed:', {
     event: 'event_button',
     buttonName: name,
     buttonLocation: location
   });    // Delay the navigation to the link's href by a short time to ensure tracking is done
   setTimeout(function() {
     window.location.href = href;
   }, 300);  // 300ms delay should be enough
 }  // Attach event listeners to each action button
 actionButtons.forEach(button => {
   button.addEventListener('click', function(event) {
     trackClick(event, button);
   });
 });
});
</script>

Hide

🙈
Class type
Display
non
See div in Navigtor

Text Wrap Pretty/Balance

🎀 🤸
Class
Wrap
pretty
balance
we love design systems to, and webflow. Now go out there are get it - Wir lieben auch Designsysteme und Webflow. Also, geh raus und hol es dir!
we love design systems to, and webflow. Now go out there are get it - Wir lieben auch Designsysteme und Webflow. Also, geh raus und hol es dir!

DOM element

🌎
Element
Tag, Attribute, Name

Images

Some simple extended class for when using images in certain conditions.
Class type
Max-Width
Width
Height
Fit
100%
100%
100%
100%
Cover
100%
Contain