Skip to content

Commit

Permalink
Enhance logging to follow stape conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
mithredate committed May 3, 2024
1 parent e171e34 commit f9ff2eb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 11 additions & 3 deletions template.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ if (isLoggingEnabled) {
if (validateUserData()){
sendConversionToLinkedIn();
} else {
logToConsole('No conversion event was sent to CAPI. You must set 1 out of the 4 acceptable IDs (SHA256_EMAIL, LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID, ACXIOM_ID, ORACLE_MOAT_ID) to resolve this issue or make certain to send both firstName and lastName.');
if (isLoggingEnabled) {
logToConsole({
Name: 'LinkedIn',
Type: 'Message',
TraceId: traceId,
EventName: postBody.eventId,
Message: 'No conversion event was sent to LinkedIn CAPI.',
Reason: 'You must set 1 out of the 4 acceptable IDs (SHA256_EMAIL, LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID, ACXIOM_ID, ORACLE_MOAT_ID) to resolve this issue or make certain to send both firstName and lastName.',
});
}

data.gtmOnFailure();
}
Expand All @@ -83,8 +92,7 @@ function validateUserData() {
return true;
}

return postBody.user.userInfo.firstName != "" &&
postBody.user.userInfo.lastName != "";
return postBody.user.userInfo.firstName && postBody.user.userInfo.lastName;
}


Expand Down
14 changes: 11 additions & 3 deletions template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,16 @@ if (isLoggingEnabled) {
if (validateUserData()){
sendConversionToLinkedIn();
} else {
logToConsole('No conversion event was sent to CAPI. You must set 1 out of the 4 acceptable IDs (SHA256_EMAIL, LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID, ACXIOM_ID, ORACLE_MOAT_ID) to resolve this issue or make certain to send both firstName and lastName.');
if (isLoggingEnabled) {
logToConsole({
Name: 'LinkedIn',
Type: 'Message',
TraceId: traceId,
EventName: postBody.eventId,
Message: 'No conversion event was sent to LinkedIn CAPI.',
Reason: 'You must set 1 out of the 4 acceptable IDs (SHA256_EMAIL, LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID, ACXIOM_ID, ORACLE_MOAT_ID) to resolve this issue or make certain to send both firstName and lastName.',
});
}

data.gtmOnFailure();
}
Expand All @@ -386,8 +395,7 @@ function validateUserData() {
return true;
}

return postBody.user.userInfo.firstName != "" &&
postBody.user.userInfo.lastName != "";
return postBody.user.userInfo.firstName && postBody.user.userInfo.lastName;
}


Expand Down

0 comments on commit f9ff2eb

Please sign in to comment.