Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
487 B
4
Indexable
Never
 useEffect(() => {
    const quarterInterval = ((article?.localized?.timeToRead ?? 1) / 4) * 60 * 1000;
    let quarterCount = 1;
    const interval = setInterval(() => {
      if (quarterCount > 4) {
        clearInterval(quarterInterval);
        return;
      }
      if (quarterCount === 3) return;
      gtm.contentConsumptionTime(quarterCount * 0.25);
      quarterCount++;
    }, quarterInterval);
    return () => clearInterval(interval);
  }, [article?.localized]);
Leave a Comment