Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this the way to implement stepped scroll tracking? #252

Open
Jogai opened this issue Dec 11, 2019 · 0 comments
Open

Is this the way to implement stepped scroll tracking? #252

Jogai opened this issue Dec 11, 2019 · 0 comments

Comments

@Jogai
Copy link

Jogai commented Dec 11, 2019

What I want is to send only one event per range. So if I divide my page in quarters I send an event for 25, 50, 75 and 100%.

A user that scrolls to 33%, then to 44%, then back to 36% would once send an event with 25 as eventLabel.

Sorry I was rubber ducking, I think this should work:

    ga('require', 'maxScrollTracker', {
            increaseThreshold: 25,
            hitFilter: function(model) {
                var scrollPercentage = model.get('eventLabel');
                // round to 25's
                model.set('eventLabel', 25 * Math.round(scrollPercentage / 25), true);
            }
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant