简体   繁体   中英

Track GA4 custom event

I am sending a custom event ("ebook") with a parameter ("titolo") to GA4. After that, I have set the parameter as a Custom Dimension in GA UI.

I am sending the event from my website with this code:

function ebooksGA4new(title) {
    gtag('event', 'ebooks', {
        'titolo': title
    });
}

Then I have set an Exploration on the custom dimension, but after 3 days it still reports "not_set. If I fire the event, I can see it in the real-time report.

Here are 2 ways to find out why

  1. Modify the code a bit, make sure it won't trigger the event if it doesn't have title parameter.

But please make sure this is what you want . You need to decide it is ok or not to receive the event without title parameter.

function ebooksGA4new(title) {
    if(!title || title=="")
      return false;
    gtag('event', 'ebooks', {
        'titolo': title
    });
}
  1. Open the chrome devtool or something similar with it. Here is the screenshot about how to check it. This should appear on your GA4 real time report as well.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM