Google Analytics Setup Guide for TanaFlows Theme
This document provides a comprehensive list of key CSS Selectors (Classes and IDs) in the TanaFlows theme, allowing you or your development team to easily configure custom Event Tracking using Google Tag Manager (GTM) or Google Analytics 4 (GA4).
1. CSS Selectors Reference for Event Tracking
Below are the main interactive elements on the theme and their corresponding selectors to use as firing conditions (Triggers) in GTM:
| Area / Component | User Action | Target CSS Selector | Recommended Event Name (GA4) | Notes / Collected Event Parameters |
|---|---|---|---|---|
| Header | Click main CTA button | a.btn-menu | header_cta_click | The primary registration or call-to-action button in the header’s right corner. |
| Click Search icon | .btn-search | search_open | Tracks how often users click to open the search overlay. | |
| Switch language | .language-dropdown-trigger | language_switch | Tracks reader language-switching behaviors. | |
| Toggle Dark Mode | button.dark-mode-toggle | theme_toggle_click | Tracks light/dark interface switching behaviors. | |
| Biolink Page | Click biolink list button | a.biolink-btn | biolink_link_click | Primary buttons in the Biolink list. Can collect Click URL and Click Text. |
| Click Hero CTA | a.hero-cta-button | biolink_hero_cta_click | The prominent CTA button located in the Hero section of the author page. | |
| Click social icons | .author-social-link | biolink_social_click | Author’s social media links (Facebook, Twitter, GitHub, etc.). | |
| Click back to home | a.author-nav-back-link | biolink_back_home | Tracks users exiting the biolink page back to the blog. | |
| Product Page | Click Buy Now | a.product-btn-primary.lemonsqueezy-button | product_buy_click | The main checkout checkout button (e.g., Lemon Squeezy, Gumroad). |
| Click View Live Demo | a.product-btn-secondary#live-demo | product_demo_click | The button to preview the product live demo. | |
| Click Testimonial URL | .product-sidebar-box a | product_testimonial_web_click | Click on the personal website link of the testimonial author. | |
| Course Page | Click to unlock lesson | button[data-portal="signup/free"] | course_unlock_click | Logged-out users clicking the CTA to unlock the lesson. |
| Click start/resume | button containing @click*="setCurrentLesson" | course_start_click | Clicks the “Start Now” or “Continue” action buttons on a course. | |
| Select lesson in sidebar | a.course-lesson-btn | course_lesson_select | Switching lessons via the sidebar. Collects Click Text (lesson title). | |
| Click Next Lesson | button containing @click="nextLesson" | course_next_lesson | Clicking the next lesson button at the end of the content. | |
| Click Previous Lesson | button containing @click="previousLesson" | course_prev_lesson | Clicking the previous lesson button at the end of the content. | |
| Newsletter / Form | Submit subscription form | Form: .subscribe-form or Button: form button[type="submit"] | newsletter_signup | Readers successfully completing the newsletter signup form. |
2. Step-by-Step Google Tag Manager (GTM) Configuration Guide
To track any button from the list above using GTM, follow these standard steps:
Step 1: Enable Default Click Variables
- Go to your GTM workspace > Variables > click Configure in the Built-In Variables panel.
- Check all variables under the Clicks section (including: Click Element, Click Classes, Click ID, Click Target, Click URL, Click Text).
Step 2: Create a Button Click Trigger
Example: Tracking clicks on the Buy Now button on your product pages:
- Go to Triggers > Click New.
- Name the trigger:
Click - Product Buy Button. - Select trigger type: Click - All Elements (or Just Links).
- Under “This trigger fires on”, select: Some Clicks.
- Set the firing condition:
- Click Classes contains
product-btn-primary - (Alternatively: Click Element matches CSS selector
a.product-btn-primary.lemonsqueezy-button).
- Click Classes contains
- Click Save.
Step 3: Configure the GA4 Event Tag
- Go to Tags > Click New.
- Name the tag:
GA4 Event - Product Buy Click. - Select tag configuration: Google Analytics > Google Analytics: GA4 Event.
- Select your GA4 Configuration Tag (or enter your Measurement ID).
- Set Event Name to:
product_buy_click. - (Optional) Add Event Parameters to send additional context:
- Parameter Name:
product_name| Value: Choose the{{Page Title}}variable (or type a custom name) to identify which product was clicked.
- Parameter Name:
- Under the Triggering section: Select the
Click - Product Buy Buttontrigger created in Step 2. - Click Save, then click Submit to publish your changes.