How can Google Analytics track the number of views for each article on a Webflow website when a popup opens instead of going to a new page?

Published on
September 22, 2023

To track the number of views for each article on a Webflow website, even when a popup opens instead of going to a new page, you can utilize Google Analytics Events.

Here's a step-by-step guide on how to achieve this:

  1. Set up Google Analytics on your Webflow website by adding your tracking code to the site settings.
  2. Identify the element that triggers the opening of the popup, such as a button or link.
  3. In Webflow's Designer, select the element that triggers the popup.
  4. In the element's settings panel, click on the "Settings" tab, then click on the "Add Attribute" button.
  5. Add a custom attribute named "onclick" (without quotes) and set its value to the following code snippet: ga('send', 'event', 'Popup', 'open', 'Article Title');
  • Replace "Popup" with a category name that best represents the action being taken within the popup.
  • Replace "open" with an action name that describes the event you want to track (e.g., "open", "click", etc.).
  • Replace "Article Title" with a dynamic value that represents the article being viewed. You can use Webflow's CMS to retrieve the article title dynamically if you have a collection set up.
  1. Save your changes and publish your website.
  2. Test the implementation by opening the popup and checking your Google Analytics reports. The event should appear in the "Behavior" section under "Events".

This setup will allow Google Analytics to track the number of views for each article on your Webflow website, even when a popup opens instead of going to a new page. You'll be able to analyze the data and gain insights into user engagement with your articles.

Additional Tips:

  • Make sure you have proper goals and conversions set up in Google Analytics to track specific user actions within the popup.
  • Utilize Google Tag Manager for more advanced event tracking and integration with other tools.

By correctly setting up the custom events, Google Analytics will be able to track the popup openings and attribute them to specific articles, giving you valuable insights into user behavior and popular content on your website.

Q: How do I add Google Analytics to my Webflow website?
Q: Can I track conversions within a popup using Google Analytics?
Q: How do I set up goals in Google Analytics for article views?