Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When passing user_data per documentation it does not handle undefined values #28

Open
agustinv opened this issue Feb 15, 2022 · 3 comments

Comments

@agustinv
Copy link

agustinv commented Feb 15, 2022

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.

@teophilus
Copy link

Good call! This was kicking my ass!

@skaaptjop
Copy link

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
Copy link

Looks like this is resolved incommit e4ebdf48fdfee975755614579e9664be7876a235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants