Skip to content

Commit

Permalink
fix(ga4): firebaseAppId config field issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 committed Aug 1, 2023
1 parent 9b1074b commit 3d1bccc
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 24 deletions.
151 changes: 130 additions & 21 deletions src/configurations/destinations/ga4/schema.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
{
"configSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"required": ["apiSecret", "typesOfClient", "measurementId", "firebaseAppId"],
"required": [
"apiSecret",
"typesOfClient"
],
"type": "object",
"properties": {
"apiSecret": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"typesOfClient": { "type": "string", "enum": ["gtag", "firebase"], "default": "gtag" },
"measurementId": {
"typesOfClient": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(G-.{1,100})$|^$"
"enum": [
"gtag",
"firebase"
],
"default": "gtag"
},
"firebaseAppId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"debugMode": {
"type": "boolean",
"default": false
},
"debugMode": { "type": "boolean", "default": false },
"eventFilteringOption": {
"type": "string",
"enum": ["disable", "whitelistedEvents", "blacklistedEvents"],
"enum": [
"disable",
"whitelistedEvents",
"blacklistedEvents"
],
"default": "disable"
},
"whitelistedEvents": {
Expand Down Expand Up @@ -61,30 +70,130 @@
},
"capturePageView": {
"type": "object",
"properties": { "web": { "type": "string", "enum": ["rs", "gtag"], "default": "rs" } }
"properties": {
"web": {
"type": "string",
"enum": [
"rs",
"gtag"
],
"default": "rs"
}
}
},
"debugView": {
"type": "object",
"properties": {
"web": {
"type": "boolean"
}
}
},
"extendPageViewParams": {
"type": "object",
"properties": {
"web": {
"type": "boolean"
}
}
},
"debugView": { "type": "object", "properties": { "web": { "type": "boolean" } } },
"extendPageViewParams": { "type": "object", "properties": { "web": { "type": "boolean" } } },
"overrideClientAndSessionId": {
"type": "object",
"properties": { "web": { "type": "boolean" } }
"properties": {
"web": {
"type": "boolean"
}
}
},
"useNativeSDK": {
"type": "object",
"properties": {
"android": { "type": "boolean" },
"ios": { "type": "boolean" },
"web": { "type": "boolean" }
"android": {
"type": "boolean"
},
"ios": {
"type": "boolean"
},
"web": {
"type": "boolean"
}
}
},
"connectionMode": {
"type": "object",
"properties": {
"android": { "type": "string", "enum": ["cloud", "device"] },
"ios": { "type": "string", "enum": ["cloud", "device"] },
"web": { "type": "string", "enum": ["cloud", "device", "hybrid"] }
"android": {
"type": "string",
"enum": [
"cloud",
"device"
]
},
"ios": {
"type": "string",
"enum": [
"cloud",
"device"
]
},
"web": {
"type": "string",
"enum": [
"cloud",
"device",
"hybrid"
]
}
}
}
},
"allOf": [
{
"if": {
"properties": {
"typesOfClient": {
"const": "gtag"
}
},
"required": [
"typesOfClient"
]
},
"then": {
"properties": {
"measurementId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(G-.{1,100})$|^$"
}
},
"required": [
"measurementId"
]
}
},
{
"if": {
"properties": {
"typesOfClient": {
"const": "firebase"
}
},
"required": [
"typesOfClient"
]
},
"then": {
"properties": {
"firebaseAppId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
}
},
"required": [
"firebaseAppId"
]
}
}
}
]
}
}
}
2 changes: 1 addition & 1 deletion src/configurations/destinations/ga4/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
},
"label": "Firebase App Id",
"configKey": "firebaseAppId",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid Firebase App Id",
"note": "Enter the ID associated with your stream. Find this under Admin > Data Streams > choose your stream > Firebase App ID",
"placeholder": "e.g: 2:637908496727:web:a4284b4c99e329d5",
Expand Down
5 changes: 3 additions & 2 deletions test/data/validation/destinations/ga4.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
},
"result": false,
"err": [
"measurementId must match pattern \"(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(G-.{1,100})$|^$\""
"measurementId must match pattern \"(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(G-.{1,100})$|^$\"",
" must match \"then\" schema"
]
},
{
Expand Down Expand Up @@ -294,4 +295,4 @@
},
"result": true
}
]
]

0 comments on commit 3d1bccc

Please sign in to comment.