2

Ive been following THIS doc on how to use Google Tag Manager in conjunction with Google Analytics to track an event, which can then be shown as a goal in Google Analytics.

The event in question is someone clicking a tab on a javascript accordion.

The problem with a javascript accordion is that someone could open and close the accordion multiple times, which would in essence would trigger mulpltie times. Is it possible to only track one unique event per user, per say every 30 seconds ? So if someone opened a tab and closed it, then opened it again all within 30 seconds it would only be tracked as one event / goal ?

1 Answer 1

2

First, to answer your question: yes. When the tag fires, set a cookie for 30 seconds. Use that cookie value as a blocking trigger.

You can also implement it with no cookies, but that would involve async timeout function and global JS variables. A bit awkward.

But then on the other hand, why at all bother with it? Maybe just fire it once per pageview a be done with it.

We normally deploy the cookie or a local JS variable as a hotfix when frontend pushes too many events to the DL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.