Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
3901: Webtrekk MWA traking #1283
Link to issue
In this PR the tracking capabilities of ding_webtrekk is extended to include several new Most Wanted Actions (MWAs) like reservation, rating, carousel click etc. The implementation follows the guidelines for parameter names and values from following spreadsheet, which also lists all the tracking that is added in this PR (those marked with "Skal implementeres"):
With Webtrekk we have three methods of tracking:
I have tried to handle as much on the server as possible, since there's much more reliable and convienient access to data. Events can be completely setup and attached on the server using HTML data-attribute, and a single catch-all click-handler will take care of pushing the events in the client.
Some things like autocomplete events are dependant on dynamic data created when the user is interacting, and therefore needs to be handled in client JS. Other stuff proved very problematic to handle on the server and is also handled in the client. For example, the ding_carousel theme often doesn't even know the name of it's carousel and it would require a rework or a hacky approach, to get the needed value for tracking parameter.
Additional comments or questions
The PR also includes some fixes for some critical stuff:
It should be ready for renew now.
Scrutinizer complains about wts is not defined, but it's a global variable added by the Webtrekk script. Could maybe check if it exists in top of attach function and return early if it's not defined? Don't know if that would fix scrutinizer also.
@kasperg I updated the PR with the suggested changes. Still have a few questions/comments to some of your comments.
I also discovered a small error, which i've added a fix for. The renew-all button is implemented by checking all renewable loans and then trigger a click on the renew-selected button. In the event that a user clicked on renew-all, this would trigger two events both renew-all and -selected. Fortunately, we can use jQuery's
Regarding scrutinizer: I don't know what to do about the remaining issues. They keep disappearing/popping up again everytime I update the PR.