Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add property.type to analytics allow list answers #2671

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Operation } from "../sanitiseApplicationData/types";
const ALLOW_LIST = [
"proposal.projectType",
"application.declaration.connection",
"property.type",
];

export const getAnalyzeSessionOperations = (): Operation[] => [
Expand Down
16 changes: 8 additions & 8 deletions editor.planx.uk/src/pages/FlowEditor/lib/analyticsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type AnalyticsLogDirection =
const ALLOW_LIST = [
"proposal.projectType",
"application.declaration.connection",
"property.type",
] as const;

export type HelpClickMetadata = Record<string, string>;
Expand Down Expand Up @@ -108,7 +109,7 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({

const trackVisibilityChange = () => {
if (shouldSkipTracking()) return;

switch (document.visibilityState) {
case "hidden":
send(
Expand Down Expand Up @@ -287,12 +288,12 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({
}

function shouldSkipTracking() {
return (!shouldTrackAnalytics || !lastVisibleNodeAnalyticsLogId)
return !shouldTrackAnalytics || !lastVisibleNodeAnalyticsLogId;
}

async function trackHelpClick(metadata?: HelpClickMetadata) {
if (shouldSkipTracking()) return;

await publicClient.mutate({
mutation: gql`
mutation UpdateHasClickedHelp($id: bigint!, $metadata: jsonb = {}) {
Expand All @@ -314,7 +315,7 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({

async function trackNextStepsLinkClick(metadata?: SelectedUrlsMetadata) {
if (shouldSkipTracking()) return;

await publicClient.mutate({
mutation: gql`
mutation UpdateHasClickNextStepsLink(
Expand All @@ -340,7 +341,7 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({
flowDirection: AnalyticsLogDirection,
) {
if (shouldSkipTracking()) return;

await publicClient.mutate({
mutation: gql`
mutation UpdateFlowDirection($id: bigint!, $flow_direction: String) {
Expand All @@ -364,7 +365,7 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({
nodeId?: string,
) {
if (shouldSkipTracking()) return;

const targetNodeMetadata = nodeId ? getTargetNodeDataFromFlow(nodeId) : {};
const metadata: Record<string, NodeMetadata> = {};
metadata[`${initiator}`] = targetNodeMetadata;
Expand Down Expand Up @@ -430,7 +431,6 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({

async function updateLastVisibleNodeLogWithAllowListAnswers(nodeId: string) {
if (shouldSkipTracking()) return;


const allowListAnswers = getAllowListAnswers(nodeId);
if (!allowListAnswers) return;
Expand Down Expand Up @@ -510,7 +510,7 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({
*/
async function trackInputErrors(error: string) {
if (shouldSkipTracking()) return;

await publicClient.mutate({
mutation: gql`
mutation TrackInputErrors($id: bigint!, $error: jsonb) {
Expand Down
Loading