Shown link tracking

Hello,
what would be the best way to track (send events to scala stream collector) that the specific links (with itemId) are shown to the current user?

and ultimately what is the recommended way to figure out which of these are actioned (clicked) and which are not?
Thanks,
Milan

Hi @magaton,

what would be the best way to track (send events to scala stream collector) that the specific links (with itemId) are shown to the current user?

Wouldn’t it be sufficient for you to track the page view of the page where the link is present? How is that implemented (link is shown), is it Javascript triggered or simply present amongst the others and not all of them visible unless you scroll down?

and ultimately what is the recommended way to figure out which of these are actioned (clicked) and which are not?

We have a dedicated link click event to track such events. Take a look and see if that’s what you are after. It’s quite flexible and is suitable to track link clicks if the links are produced as a result of some Javascript injection (as opposed to be part of the initial DOM).

Maybe, I am not sure, I am still trying to find my way through snowplow documentation :slight_smile:
But one can think in terms of recommendation engines. On the product detail page I am about to show similar products but not the same all the time (the recommendation is personalised). If particular recommendation is constantly being ignored or just quickly viewed (I see page ping as useful for this case) then I want to negatively boost that recommendation and favourise the others.

Also, I am not sure I get page view and ping event in case of SPA. Several UIs where we want to integrate our recommendation widgets are angularjs apps.

On the product detail page I am about to show similar products but not the same all the time (the recommendation is personalised). If particular recommendation is constantly being ignored or just quickly viewed (I see page ping as useful for this case) then I want to negatively boost that recommendation and favourise the others.

I think it would be better to use context as the list of the itemIds of the recommended products present on the page. It would be added to the trackPageView event.

Roughly it could look like this

window.snowplow(
  'trackPageView',

  // no custom title
  null,

  // List of itemIds shown on the page
  [{
     schema: 'iglu:com.acme/product_shown/jsonschema/1-0-0',
     data: {
       itemId: 'ABC123'
     }
   },
   {
     schema: 'iglu:com.acme/product_shown/jsonschema/1-0-0',
     data: {
       itemId: 'DEF456'
     }
   }]
);
1 Like

:+1: for this suggestion.

My only point of difference would be that you may possibly want to set this event to trigger not on page view but on DOM visible - if for example your recommendation widget is at the bottom of the page or outside of immediate screen view you may wish to trigger the event when the entire widget/all items are in view within the browser/app.

2 Likes

Thank you!

Mike’s suggestion is close to perfect, but you’d probably want to know the depth of coverage as well, not only what suggested items were viewed. I’d have both. When Dom loaded, trigger a context attracted to pageview, on Dom visible send a custom event with items viewed.

Hi, could you please clarify what you mean by TRIGGER a context attracted to pageview?
Is there any example similar to this use case?

Also, in case of custom contexts, I guess I’d need to upload my own schema into iglu repository, which then i would need to host somewhere. Is there a chance to reuse some of the existing schema (in this case I need only one string property to represent itemId and nothing else)?

Hi @magaton,

The code snippet I provided earlier does just that. When page view event is triggered (takes place), it is fired (sent to the collector) together with the custom context (itemIds).

Generally, custom contexts can be added (attached) as an extra argument to any of Snowplow’s track..() methods and to addItem and addTrans: 2 Specific event tracking with the Javascript tracker · snowplow/snowplow Wiki · GitHub