Instantsearch.js: [GA analytics widget]: clicking on pagination doesn't trigger pushFunction

Created on 21 Sep 2017  路  7Comments  路  Source: algolia/instantsearch.js

If you use the analytics with this configuration, pushFunction is not triggered when a user clicks on a new page. With the triggerOnUIInteraction option to true, we expect that it is.

movies.addWidget(
  instantsearch.widgets.analytics({
    pushFunction: function(formattedParameters, state, results) {
           console.log('pushFunction')
    },
    pushInitialSearch: true,
    triggerOnUIInteraction: true,
    delay: 0, 
  })
);

Here is a jsfiddle reproducing the issue: https://jsfiddle.net/mthuret/j9nwpz34/23/

Bug Needs Investigation

Most helpful comment

When clicking on a link of the pagination widget, pushFuction is not triggered whereas if you select something using the refinement list it is.

This was first reported by a user on support.

All 7 comments

Hi @mthuret, thanks for opening this ;)

What do you mean by 'when a user clicks on a new page"? Is it like when a user clicks on a link?

When clicking on a link of the pagination widget, pushFuction is not triggered whereas if you select something using the refinement list it is.

This was first reported by a user on support.

There seems to be two problems here, in your example the clicks do not trigger the analytics function and when the page is updated is not called either.

The bug with the pagination not sent with the analytics has been solved in 2.2.0-beta.1 (related PR). Also the triggerOnUIInteraction option is for triggering the analytics before we change page. Internally the widget is conservative and will not call the hook if the state hasn't changed.

Thanks for digging into this @bobylito! Will this fix be ported to v1 or update to v2 is the way to get it?

We have no plan to backport it (it's implemented as a feature) and it's not yet released as part of a stable release. Let me know if it causes too much problem and will find a way to backport it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristopherDosin picture ChristopherDosin  路  4Comments

francoischalifour picture francoischalifour  路  3Comments

vvo picture vvo  路  4Comments

bobylito picture bobylito  路  3Comments

zeke picture zeke  路  3Comments