How to use @times-components/tracking - 10 common examples

To help you get started, we’ve selected a few @times-components/tracking examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github newsuk / times-components / packages / article-topics / __tests__ / shared.base.js View on Github external
test: () => {
        const analyticsStream = jest.fn();

        const ArticleTopicsWithTracking = withTrackingContext(ArticleTopics, {
          trackingObjectName: "Article"
        });

        const testInstance = TestRenderer.create(
           {}}
            topics={topicData}
          />
        );

        const [link] = testInstance.root.findAll(node => node.type === Link);

        link.props.onPress("event");

        expect(analyticsStream.mock.calls).toMatchSnapshot();
github newsuk / times-components / packages / save-and-share-bar / src / tracking / with-track-events.js View on Github external
export default Component =>
  withTrackEvents(Component, {
    analyticsEvents: [
      {
        actionName: "Pressed",
        eventName: "onSaveToMyArticles",
        getAttrs: ({ articleId, articleHeadline }) => ({
          articleId,
          articleHeadline
        }),
        trackingName: "ArticleSaveToMyArticles"
      },
      {
        actionName: "Pressed",
        eventName: "onShareEmail",
        getAttrs: ({ articleId, articleHeadline }) => ({
          articleId,
          articleHeadline
github newsuk / times-components / packages / edition-slices / src / tiles / shared / tile-tracking-events.js View on Github external
export default Component =>
  withTrackEvents(Component, {
    analyticsEvents: [
      {
        actionName: "Pressed",
        eventName: "onPress",
        getAttrs: ({
          tile: {
            headline: tileHeadline,
            article: { headline, id, shortHeadline, url } = {}
          } = {
            article: {}
          },
          tileName
        }) => ({
          articleHeadline: tileHeadline || shortHeadline || headline,
          articleId: id,
          articleUrl: url,
github newsuk / times-components / packages / article-topics / src / article-topic.js View on Github external
accessibilityTraits="button"
                style={[styles.text, fontSizeStyle, lineHeightStyle]}
              >
                {name}
              
            
          
        
      )}
    
  );
};

ArticleTopic.propTypes = topicPropTypes;

export default withTrackEvents(ArticleTopic, {
  analyticsEvents: [
    {
      actionName: "Pressed",
      eventName: "onPress",
      getAttrs: ({ name, slug }) => ({
        name,
        slug
      }),
      trackingName: "TopicLink"
    }
  ]
});
github newsuk / times-components / packages / author-head / src / author-head.js View on Github external
@{handle}
      
    
  );
};

TwitterLink.propTypes = {
  handle: AuthorHead.propTypes.twitter,
  onPress: PropTypes.func.isRequired
};

TwitterLink.defaultProps = {
  handle: AuthorHead.defaultProps.twitter
};

export default withTrackEvents(AuthorHead, {
  analyticsEvents: [
    {
      eventName: "onTwitterLinkPress",
      actionName: "Pressed",
      trackingName: "TwitterLink",
      getAttrs: (props, eventArgs) => ({
        twitterHandle: props.twitter,
        url: eventArgs[1] && eventArgs[1].url
      })
    }
  ]
});
github newsuk / times-components / packages / author-profile / src / author-profile-head-tracking-events.js View on Github external
export default Component =>
  withTrackEvents(Component, {
    analyticsEvents: [
      {
        actionName: "Pressed",
        eventName: "onTwitterLinkPress",
        getAttrs: (props, eventArgs) => ({
          twitterHandle: props.twitter,
          url: eventArgs[1] && eventArgs[1].url
        }),
        trackingName: "TwitterLink"
      }
    ]
  });
github newsuk / times-components / packages / save-star-web / src / tracking / with-track-events.js View on Github external
export default Component =>
  withTrackEvents(Component, {
    analyticsEvents: [
      {
        actionName: "Pressed",
        eventName: "onSave",
        getAttrs: ({ articleId, savedStatus }) => ({
          articleId,
          savedStatus: !savedStatus
        }),
        trackingName: "ArticleSaveToMyArticles"
      }
    ]
  });
github newsuk / times-components / packages / article-skeleton / src / article-body / article-link-tracking-events.js View on Github external
export default Component =>
  withTrackEvents(Component, {
    analyticsEvents: [
      {
        actionName: "Pressed",
        eventName: "onPress",
        getAttrs: ({ linkType, url }) => ({
          linkType,
          linkUrl: url
        }),
        trackingName: "ArticleLink"
      }
    ]
  });
github newsuk / times-components / packages / edition-slices / src / tiles / shared / puzzle-tracking-events.js View on Github external
export default Component =>
  withTrackEvents(Component, {
    analyticsEvents: [
      {
        actionName: "Pressed",
        eventName: "onPress",
        getAttrs: ({ id, title, url }) => ({
          puzzleId: id,
          puzzleTitle: title,
          puzzleUrl: url,
          tileName: "Puzzle"
        }),
        trackingName: "Tile"
      }
    ]
  });
github newsuk / times-components / packages / article-list / src / article-list-item-tracking-events.js View on Github external
export default Component =>
  withTrackEvents(Component, {
    analyticsEvents: [
      {
        actionName: "Pressed",
        eventName: "onPress",
        getAttrs: ({ article: { headline, id }, index, length }) => ({
          articleHeadline: headline,
          articleId: id,
          scrollDepth: {
            itemNumber: index + 1,
            total: length
          }
        })
      }
    ]
  });

@times-components/tracking

Tracking

BSD-3-Clause
Latest version published 4 months ago

Package Health Score

78 / 100
Full package analysis