Skip to content

Commit

Permalink
chore: fix sonar cloud issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip committed Dec 3, 2024
1 parent 4533bd7 commit 64297c8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/v0/destinations/google_adwords_offline_conversions/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,18 @@ const getClickConversionPayloadAndEndpoint = (
if (!properties.userIdentifierSource && UserIdentifierSource !== 'none') {
set(payload, 'conversions[0].userIdentifiers[0].userIdentifierSource', UserIdentifierSource);
// one of email or phone must be provided when none of gclid, wbraid and gbraid provided
if (!email && !phone && !hasClickId(payload.conversions[0])) {
}
if (!email && !phone) {
if (!hasClickId(payload.conversions[0])) {
throw new InstrumentationError(
`Either an email address or a phone number is required for user identification when none of gclid, wbraid, or gbraid is provided.`,
);
} else {
// we are deleting userIdentifiers if any one of gclid, wbraid and gbraid is there but email or phone is not present
delete payload.conversions[0].userIdentifiers;
}
}
// we are deleting userIdentifiers if any one of gclid, wbraid and gbraid is there but email or phone is not present
if (hasClickId(payload.conversions[0]) && !email && !phone) {
delete payload.conversions[0].userIdentifiers;
}

// either of email or phone should be passed
// defaultUserIdentifier depends on the webapp configuration
// Ref - https://developers.google.com/google-ads/api/rest/reference/rest/v11/customers/uploadClickConversions#ClickConversion
Expand Down

0 comments on commit 64297c8

Please sign in to comment.