Skip to content

Commit ca4b067

Browse files
authored
Update template.tpl
Adding validation to check if firstName, lastName are present.
1 parent 616d042 commit ca4b067

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

template.tpl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ var postBody ={'conversion': conversion_rule_urn,
156156
if (validateUserData()){
157157
sendConversionToLinkedIn();
158158
} else {
159-
logToConsole('No conversion event was sent to CAPI. You must set 1 out of the 4 acceptable IDs (Acxiom, Oracle, SHA256_Email or LinkedIn_UUID) on eventModel.user_data to resolve this issue.');
159+
logToConsole('No conversion event was sent to CAPI. You must set 1 out of the 4 acceptable IDs (Acxiom, Oracle, SHA256_Email or LinkedIn_UUID) on eventModel.user_data to resolve this issue or make certain to send both firstName and lastName under eventModel.user_data.address.first_name and eventModel.user_data.address.last_name.');
160160
}
161161

162162
function validateUserData() {
@@ -170,6 +170,15 @@ function validateUserData() {
170170
break;
171171
}
172172
}
173+
// if the flag is false, check for first name last name. if both present,
174+
// flip flag to true, send the API call
175+
if (data_is_valid_flag == false){
176+
if (conversion_event.userData.userInfo.firstName != "" && conversion_event.userData.userInfo.lastName != ""){
177+
data_is_valid_flag = true;
178+
}
179+
}
180+
181+
173182
return data_is_valid_flag;
174183
}
175184

@@ -267,5 +276,3 @@ scenarios: []
267276
___NOTES___
268277

269278
Created on 9/27/2023, 11:40:00 AM
270-
271-

0 commit comments

Comments
 (0)