Amazing video! I just discovered your channel today and hands down you’re the best and the most informative out there. Will definitely keep an out on your amazing content. If possible, do create a cookie collector script for different sources and medium for GTM. Let’s nail the coffin! Blessings 💯
Thanks for the easy to follow video! Could I use this to set up a conversion for Meta ads? It is just a matter of adding the event/trigger to the Facebook Pixel tag? Thanks :)
I’m not able to configure the session_duration tag. There is no “configuration tag” box / drop-down, just a box with the “Measurement ID”. Could it have something to do with the recent migration to the “Google tag”? Thank you.
GA4 now allows you to set up a session duration goal without the use of GTM. However, you are going to have to create a audience and set an audience trigger. This trigger will show data in events which you can later set as conversion
Hey you're right! I'm actually preparing a video on this. I stil believe the method in this video is valid in many cases but if you don't want to use GTM your suggestion is a great option.
10 месяцев назад
Hey @LeonKorteweg - thanks for your work here at RUclips. It helps a lot of people - I am sure. Leon, I have a question: The JSON settings file from your dropbox link is creating an error message while importing to GTM since a while. Any idea what's wrong? In the past it worked without any problem 🤔
Hi @LeonKorteweg , what to adjust on the script if I want to track people who viewed between 0-10 seconds? I typed in 0.166667 min to the script but there is no session_duration_0.166667 min recorded on my GA 4.. it only tracked session_duration_1min, session_duration_2min, session_duration_3min, session_duration_5min... Thank you in advance Leon.
Hey, more people have asked for this in the comments. But I'm afraid that a more thorough change is necessary to achieve this. Can't promise, but I might add this in a new version sometime in the future. A quick workaround would be to use a 10 second timer trigger to track an event after 10s. The only difference from my script is that the timer will not continue counting after navigating to the next page (as far as I know) and it will fire on every page after 10 seconds.
Hi Pascal, I know I've already answered your question elsewhere but I will include my answer here for others to read along: Based on your comment I've tested the solution. It works on my end. Please keep your site open and 'in focus' for a while. After a while you should see the events rolling in.
This is awesome. Follow up question: I want to track a 30 second duration conversion. I tried changing the minute marker to ".5," but this didn't work when I tested. Do I need to make additional modifications in order for this to function?
Thanks 😎 You're right, it's probably not capable of doing that right now. But I think it's an excellent suggestion. Let me think about a way to solve this elegantly and I'll try to post an upgrade asap.
What screen are you referring to exactly? Do you have a minute marker in the video of the screen you're missing? I know that Google has been rolling out a new admin screen yesterday (I believe). So that might be the cause of your confusion..
Hi Leon, thanks for this great video. Maybe this question is too stupid: is it necessary - like for other tags I created - to add a Custom Definition in GA4 to get the data there (and from there to GoogleAds)?
Depends on what exactly you're trying to achieve, but probably not. If it confuses you I would wait and get the basics under control first. They are not necessary if you only want to track conversions in GA4 and Google Ads. Custom definitions are only really necessary if you decide to send extra information (parameters) along with your custom events. And then specifically only for the parameters that aren't available by default. I use a lot of custom statistics in my setups for convenience (this is a video on my technique: ruclips.net/video/aNkY_2n3FUA/видео.html&ab_channel=LeonKorteweg)
Hey a big thanks for this. You seem to be the only person with a solution to this problem. I imported your code and got it all running as expected. Do you think there is any concern about adding lag/bloat with the datalayer remembering and counting the duration for every session?
Great to hear you've found this useful! Performance should be no issue. The script that I made is very small and lightweight. Also, I've used this on many sites, large and small, and I've had no performance issues whatsoever.
Again, thanks! With this setup every count is value=1. But I'd like to set higher values for longer visits. Is this possible to change in GTM? Or do I need to setup several triggers when value meets the minute demand, individually one by one?
If you want to track sessions that last longer. Let's say for example, 60 minutes. The only thing you have to do is go to the Session duration script tag and change this line: minuteMarkers: [1, 2, 3, 5, 10, 30], ..into this: minuteMarkers: [1, 2, 3, 5, 10, 30, 60], So you add the number 60 at the end of the list. The script will take care of the rest.
@@LeonKorteweg I´d like to add another value for longer visits, not track another lenght :-) So the visitors staying say 30 sec are value=1 but say 60 sec would be value=10. How to change the value of the different lenghts of visit in this set up?
@@TrailerimportSe Ah now I understand.. you'd need a Lookup table for this. You use {{dataLayer - Session Duration Minutes}} as input and then you can define what value you want to output per different minute marker.
@@LeonKorteweg Thanks! After struggling a bit I managed to do it. Actually I don´t understand what I was doing wrong for 2 hours 😀 But It works for now in the debugger/tag assistent.
Hi @LeonKorteweg, thank you for this step by step, it works on mine! How about if we want to track "No of visitors viewing one page" on GA4? Mind sharing, if you know how please? I've been trying for months to set it up, but no clue.. used to have this metric on UA ..Thank you
Do you mean a conversion based on a certain amount of pages? Because a threshold of one page would include every visitor.. I think this can be done by creating an audience in GA4 where you set up a threshold based on the number of pages. Use the audience trigger to track a new event every time someone enters that audience. But thanks for your comment. I might make a video about this someday 😁
@@LeonKorteweg what i meant is how to get total visitor that view at least one page on our website? What I did is in the exploration report, I created segment > include session when session_start , event count = 1..
Hey! Thanks 👊🏻 I personally have no experience with Adobe Launch, but I have been able to make it work with Piwik Pro. My solution pushes the session duration events into the dataLayer, so someone with knowledge on GTM and the dataLayer should be able to set this up for you (as long as your GA alternative has some event tracking mechanism).
Ah thanks 👍🏻 I know what you mean. This would indeed be a valid alternative. I've tried using audiences to make conversions based on number of pages per session in the past. The biggest downside I encountered was that you cannot edit audiences after they have been created. And I remember that I had issues with thresholding, but it was quite some time back.
@@LeonKorteweg Cool if possible you can create a youtube video to use session duration in GA4 custom audience. I know the option exist but for some reason I am not able to make it work. Many people like me are looking to track session duration without injecting any custom code.
Looking for ways to grow your traffic? ►► Grab my FREE cheatsheet here at: leonkorteweg.com/cheatsheet
This looks like a great goal to set up. I'm going to implement this on a client site.
thanks 🙏
So helpfull! Thanks a lot 🙏 Smooth installation and working pefectly!
Thanks a lot! It looks really helpful. Subscribed:)
Amazing video! I just discovered your channel today and hands down you’re the best and the most informative out there. Will definitely keep an out on your amazing content. If possible, do create a cookie collector script for different sources and medium for GTM. Let’s nail the coffin! Blessings 💯
Thanks for the kind words! And interesting idea. Do you mean a script that takes UTM parameters and stores them in a cookie?
Thanks for the easy to follow video! Could I use this to set up a conversion for Meta ads? It is just a matter of adding the event/trigger to the Facebook Pixel tag? Thanks :)
I’m not able to configure the session_duration tag. There is no “configuration tag” box / drop-down, just a box with the “Measurement ID”. Could it have something to do with the recent migration to the “Google tag”? Thank you.
GA4 now allows you to set up a session duration goal without the use of GTM. However, you are going to have to create a audience and set an audience trigger. This trigger will show data in events which you can later set as conversion
Hey you're right! I'm actually preparing a video on this.
I stil believe the method in this video is valid in many cases but if you don't want to use GTM your suggestion is a great option.
Hey @LeonKorteweg - thanks for your work here at RUclips. It helps a lot of people - I am sure. Leon, I have a question: The JSON settings file from your dropbox link is creating an error message while importing to GTM since a while. Any idea what's wrong? In the past it worked without any problem 🤔
Thanks for the notice! I've gone ahead and updated it. It should work again now..
Hey @@LeonKorteweg, thank you very much for the reply and the immediate update of the JSON settings file 🎉 Great job!
Hi @LeonKorteweg , what to adjust on the script if I want to track people who viewed between 0-10 seconds? I typed in 0.166667 min to the script but there is no session_duration_0.166667 min recorded on my GA 4.. it only tracked session_duration_1min, session_duration_2min, session_duration_3min, session_duration_5min... Thank you in advance Leon.
Hey, more people have asked for this in the comments. But I'm afraid that a more thorough change is necessary to achieve this. Can't promise, but I might add this in a new version sometime in the future.
A quick workaround would be to use a 10 second timer trigger to track an event after 10s. The only difference from my script is that the timer will not continue counting after navigating to the next page (as far as I know) and it will fire on every page after 10 seconds.
thank you information , but Dropbox link gives error. I want to receive the json file.
The link still works for me: www.dropbox.com/s/4i6a8fyhi8enhdr/20230309-session-duration.json?e=1&dl=0
Anobody else has this issue?
I installed the container template however, no events take place when i debug tagmanager. What can i do?
Hi Pascal, I know I've already answered your question elsewhere but I will include my answer here for others to read along:
Based on your comment I've tested the solution. It works on my end. Please keep your site open and 'in focus' for a while. After a while you should see the events rolling in.
This is awesome. Follow up question: I want to track a 30 second duration conversion. I tried changing the minute marker to ".5," but this didn't work when I tested. Do I need to make additional modifications in order for this to function?
Thanks 😎 You're right, it's probably not capable of doing that right now. But I think it's an excellent suggestion. Let me think about a way to solve this elegantly and I'll try to post an upgrade asap.
My Google Analytics screen looks nothing like yours. I don't have GOALS but only Conversions > Add filters
What screen are you referring to exactly? Do you have a minute marker in the video of the screen you're missing?
I know that Google has been rolling out a new admin screen yesterday (I believe). So that might be the cause of your confusion..
Hi Leon, thanks for this great video. Maybe this question is too stupid: is it necessary - like for other tags I created - to add a Custom Definition in GA4 to get the data there (and from there to GoogleAds)?
Depends on what exactly you're trying to achieve, but probably not. If it confuses you I would wait and get the basics under control first. They are not necessary if you only want to track conversions in GA4 and Google Ads.
Custom definitions are only really necessary if you decide to send extra information (parameters) along with your custom events. And then specifically only for the parameters that aren't available by default.
I use a lot of custom statistics in my setups for convenience (this is a video on my technique: ruclips.net/video/aNkY_2n3FUA/видео.html&ab_channel=LeonKorteweg)
Hey a big thanks for this. You seem to be the only person with a solution to this problem. I imported your code and got it all running as expected.
Do you think there is any concern about adding lag/bloat with the datalayer remembering and counting the duration for every session?
Great to hear you've found this useful! Performance should be no issue. The script that I made is very small and lightweight. Also, I've used this on many sites, large and small, and I've had no performance issues whatsoever.
@@LeonKorteweg Sounds good. Thanks Leon
Again, thanks!
With this setup every count is value=1.
But I'd like to set higher values for longer visits. Is this possible to change in GTM?
Or do I need to setup several triggers when value meets the minute demand, individually one by one?
If you want to track sessions that last longer. Let's say for example, 60 minutes. The only thing you have to do is go to the Session duration script tag and change this line:
minuteMarkers: [1, 2, 3, 5, 10, 30],
..into this:
minuteMarkers: [1, 2, 3, 5, 10, 30, 60],
So you add the number 60 at the end of the list. The script will take care of the rest.
@@LeonKorteweg I´d like to add another value for longer visits, not track another lenght :-) So the visitors staying say 30 sec are value=1 but say 60 sec would be value=10. How to change the value of the different lenghts of visit in this set up?
@@TrailerimportSe Ah now I understand.. you'd need a Lookup table for this. You use {{dataLayer - Session Duration Minutes}} as input and then you can define what value you want to output per different minute marker.
@@LeonKorteweg Thanks! After struggling a bit I managed to do it. Actually I don´t understand what I was doing wrong for 2 hours 😀 But It works for now in the debugger/tag assistent.
Hi @LeonKorteweg, thank you for this step by step, it works on mine! How about if we want to track "No of visitors viewing one page" on GA4? Mind sharing, if you know how please? I've been trying for months to set it up, but no clue.. used to have this metric on UA ..Thank you
Do you mean a conversion based on a certain amount of pages? Because a threshold of one page would include every visitor..
I think this can be done by creating an audience in GA4 where you set up a threshold based on the number of pages. Use the audience trigger to track a new event every time someone enters that audience.
But thanks for your comment. I might make a video about this someday 😁
@@LeonKorteweg what i meant is how to get total visitor that view at least one page on our website? What I did is in the exploration report, I created segment > include session when session_start , event count = 1..
Hi
This is awesome, Can you suggest anything like this for adobe launch
Hey! Thanks 👊🏻 I personally have no experience with Adobe Launch, but I have been able to make it work with Piwik Pro. My solution pushes the session duration events into the dataLayer, so someone with knowledge on GTM and the dataLayer should be able to set this up for you (as long as your GA alternative has some event tracking mechanism).
@@LeonKorteweg Thanks for the quick reply,
GA4 has added this now
Hmm, I've not seen it anywhere so I'm wondering if you perhaps mean something else. Do you have a link to some docs or release statement?
@@LeonKorteweg In GA4 audience there is option to create conversion based on session duration.
Ah thanks 👍🏻 I know what you mean. This would indeed be a valid alternative. I've tried using audiences to make conversions based on number of pages per session in the past. The biggest downside I encountered was that you cannot edit audiences after they have been created. And I remember that I had issues with thresholding, but it was quite some time back.
@@LeonKorteweg Cool if possible you can create a youtube video to use session duration in GA4 custom audience. I know the option exist but for some reason I am not able to make it work. Many people like me are looking to track session duration without injecting any custom code.