ConversionsAPI-Tag-for-GoogleTagManager icon indicating copy to clipboard operation
ConversionsAPI-Tag-for-GoogleTagManager copied to clipboard

When passing user_data per documentation it does not handle undefined values

Open agustinv opened this issue 3 years ago • 3 comments

https://developers.facebook.com/docs/marketing-api/conversions-api/guides/gtm-server-side

Documentation suggest passing hashed user data as user_data.email_address, etc.

When this data is undefined/null on web container, it does not get removed from server side capi call, instead undefined gets hashed.

Workaround is to use x-fb-ud-em, etc.

agustinv avatar Feb 15 '22 17:02 agustinv

Good call! This was kicking my ass!

teophilus avatar Feb 22 '22 16:02 teophilus

It is there for null but not undefined

function hashFunction(input){
  if(input == null || isAlreadyHashed(input)){
    return input;
  }

  return sha256Sync(input.trim().toLowerCase(), {outputEncoding: 'hex'});
}

One could rewrite that first line to handle undefined

skaaptjop avatar Mar 17 '22 10:03 skaaptjop

Looks like this is resolved incommit e4ebdf48fdfee975755614579e9664be7876a235

skaaptjop avatar Mar 17 '22 10:03 skaaptjop