Selective custom contexts for link_click events (JS Tracker)

I have called ‘enableLinkClickTracking’ to send click events, but I’m wanting to selectively add a custom context for specific links.

The snowplow API provides a filter function, but I’m not wanting to disable specific link events, rather add extra context data to some.

My idea was to use custom context generator (as per this issue
Something along the lines of this:

window.snowplow('enableLinkClickTracking', null, true, true,
  [], // static contexts
 console.log('custom context');
 // pseudo code, not actual code used
 if(args data matches specific link) {
   return [{custom: 'context'}];
 return null;

However, it seems this ‘context generating function’ support only exists for ‘trackPageView’.

Is it possible to have this added, or is there an another way to do this?

1 Like

Hi @adamgriffiths - you are right, it would be great to have ‘context generating functions’ available more widely (not just for page pings). Can you create a ticket with the features you’d like to see?

Hope it’s clear enough.

Very clear! Thanks @adamgriffiths. We’ve scheduled that ticket now.