File size: 1,184 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import { ANALYTICS_EVENT_RECORD, ANALYTICS_PAGE_VIEW_RECORD } from 'calypso/state/action-types';
export const recordEvent = ( service, args ) => ( {
type: ANALYTICS_EVENT_RECORD,
meta: {
analytics: [
{
type: ANALYTICS_EVENT_RECORD,
payload: Object.assign( {}, { service }, args ),
},
],
},
} );
export const recordGoogleEvent = ( category, action, label, value ) =>
recordEvent( 'ga', { category, action, label, value } );
export const recordTracksEvent = ( name, properties ) =>
recordEvent( 'tracks', { name, properties } );
export const recordCustomFacebookConversionEvent = ( name, properties ) =>
recordEvent( 'fb', { name, properties } );
export const recordCustomAdWordsRemarketingEvent = ( properties ) =>
recordEvent( 'adwords', { properties } );
export const recordPageView = ( url, title, service, properties = {}, options = {} ) => ( {
type: ANALYTICS_PAGE_VIEW_RECORD,
meta: {
analytics: [
{
type: ANALYTICS_PAGE_VIEW_RECORD,
payload: {
service,
url,
title,
options,
...properties,
},
},
],
},
} );
export const recordGooglePageView = ( url, title ) => recordPageView( url, title, 'ga' );
|