Financial-Times / n-tracking

Client-side tracking initialisation and custom events for FT.com
8 stars 2 forks source link

Implement audio teaser view tracking in n-tracking #21

Open magsallen opened 5 years ago

magsallen commented 5 years ago

Implement audio teaser view tracking in n-tracking as it's required by several FT applications.

This code is currently required in the search page, the article page and the stream page. As the audio team is currently winding down, it makes sense to centralise this code so that the tracking events being sent by each application remain consistent without the active oversight of a team.

Example implementation from https://github.com/Financial-Times/next-search-page/pull/264


oTracking.view.init({
    selector: '.o-teaser--audio',
    getContextData: (el) => {
        return {
            componentContentId: el.getAttribute('data-id'),
            component: 'teaser',
            type: 'audio',
            subtype: 'podcast'
        };
    }
});```
i-like-robots commented 5 years ago

I agree with the rationale, but I don't think should be as straightforward as copy and pasting it.

In order to ensure this package remains supportable we need to attach some extra information to it: