Skip to content

Commit

Permalink
Update/all tracks to snake case (#38576)
Browse files Browse the repository at this point in the history
* Update all tracks to snake case and improve typing

* changelog
  • Loading branch information
CodeyGuyDylan authored Jul 29, 2024
1 parent 5aef951 commit 5883fd3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ const ConnectionStatusCard: ConnectionStatusCardType = ( {
const hasSiteConnectionBrokenModules = brokenModules?.needs_site_connection.length > 0;
const tracksEventData = useMemo( () => {
return {
userConnectionBrokenModules: brokenModules?.needs_user_connection.join( ', ' ),
siteConnectionBrokenModules: brokenModules?.needs_site_connection.join( ', ' ),
user_connection_broken_modules: brokenModules?.needs_user_connection.join( ', ' ),
site_connection_broken_modules: brokenModules?.needs_site_connection.join( ', ' ),
};
}, [ brokenModules ] );

Expand All @@ -209,7 +209,7 @@ const ConnectionStatusCard: ConnectionStatusCardType = ( {
e && e.preventDefault();
recordEvent( 'jetpack_myjetpack_connection_manage_dialog_click', {
...tracksEventData,
connectionType,
connection_type: connectionType,
} );
setIsManageConnectionDialogOpen( true );
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const GlobalNotice = ( { message, title, options } ) => {
const tracksArgs = options?.tracksArgs || {};

recordEvent( 'jetpack_myjetpack_global_notice_view', {
noticeId: options.id,
notice_id: options.id,
...tracksArgs,
} );
}, [ options.id, recordEvent, options?.tracksArgs ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function ScanStatus( { status }: { status: 'success' | 'partial' | 'off' } ) {
tracksEventProps={ {
location: 'scan',
status: status,
hasPaidPlan: false,
has_paid_plan: false,
threats: 0,
} }
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useMyJetpackConnection from '../use-my-jetpack-connection';

type TracksRecordEvent = (
event: `jetpack_${ string }`, // Enforces the event name to start with "jetpack_"
properties?: Record< string, unknown >
properties?: Record< Lowercase< string >, unknown >
) => void;

const useAnalytics = () => {
Expand Down Expand Up @@ -44,8 +44,8 @@ const useAnalytics = () => {
jetpackAnalytics.tracks.recordEvent( event, {
...properties,
version: myJetpackVersion,
isSiteConnected,
isUserConnected,
is_site_connected: isSiteConnected,
is_user_connected: isUserConnected,
referring_plugins: connectedPluginsSlugs,
} );
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const useSiteConnectionNotice = ( redBubbleAlerts: RedBubbleAlerts ) => {
isRedBubble: true,
tracksArgs: {
type: connectionError.type,
isError: connectionError.is_error,
is_error: connectionError.is_error,
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Update all tracks to snake case, camel case is not supported

0 comments on commit 5883fd3

Please sign in to comment.