Analytics
3.8K members online now
3.8K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

What code can create several events when users go to different position on the same page?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi, I wanna know whether my visitors viewed the whole page after enter into my product page. (It's a little bit long than general webpage.) I saw someone's post indicates some codes could do, and tried to install on my wordpress webpage. But failed.

 

His codes are like below:


 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

 

function fixBounce(){ var stored_height = $('#section1').outerHeight() + $('#section2').outerHeight(); var a = 0; $(document).bind('scroll',function(){ if (($(window).scrollTop() > stored_height) && (a == 0)) { ga('send','event','fix-bounce-rate','scroll','over 50%'); a = 1; } }) } $(document).ready(fixBounce);


 

I think my problem is I don't know how to define $('#section1').outerHeight() and $('#section2').outerHeight() for each section on page by <div id>. Because I use beaver builder plugin to build the appearance of that page. I can only modify the css id or class of each row. But it has html box can be insert. Can use this to define? And how to ?

1 Expert replyverified_user

What code can create several events when users go to different position on the same page?

Top Contributor
# 2
Top Contributor

Hi :-)

You may find something like the following plugin easier for installation and use when it comes to tracking scroll depth
https://wordpress.org/plugins/wp-scroll-depth/

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

What code can create several events when users go to different position on the same page?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi, Bronwyn V

 

Thanks for reply. This plugin is convenient for me. But I still wanna try to solve this problem without help from plugins. Since some bugs emerged when using certain plugin that made my website fall to run for several days.  So I become carefully to use plugins now. Anyway, thanks for help!

 

What code can create several events when users go to different position on the same page?

Explorer ✭ ✭ ✭
# 4
Explorer ✭ ✭ ✭

Hi @April C,

 

you may try setting up scroll tracking on your site
http://scrolldepth.parsnip.io/

 

hope this help

regards

Noman Karim

 

What code can create several events when users go to different position on the same page?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thank you Noman K! I'll try then.