Decoding format of user_id by snowplow

Hi,
Even after setting encodeBse64 to false, I’m getting encoded user_id.

`SNOWPLOW_NAME_HERE('newTracker', 'snplow1', 'd1qkeqs71ytz4c.cloudfront.net', {
        'appId': 'snowplowweb',
  'cookieName': 'MY_COOKIE_NAME',
  encodeBase64: false,
  contexts: {
    webPage: true,
    performanceTiming: true
  }
 });
SNOWPLOW_NAME_HERE('setUserIdFromCookie', 'user_id');
SNOWPLOW_NAME_HERE('enableActivityTracking', 10, 10);
SNOWPLOW_NAME_HERE('trackPageView');`

If its base64 encoded, I decode it using any software it is not giving me the desired result
for example ‘d09d0d4dfa27d0ea9e1b992fa61bbabdbc92dd60’ after base 64 decoding is giving me ‘wO]}wG[k[mmvu’ rather it should be just integers.

So how do I stop the encoding and what kind of encoding is it?

Are you using the PII enrichment? If so, your user IDs will be passed through a one-way cryptographic hash function.

You can’t “decode” a hash - that’s by design. Instead, you will need to build a lookup table of hashed user IDs <-to-> plain-text user IDs.

2 Likes

What’s the value of the user_id cookie? Giving that you are setting user_id from a cookie that’s what should be getting set or as @robkingston mentioned above it could be the PII enrichment if you have this enabled.

1 Like

@robkingston @mike
The value of the user id cookie is just an integer value with 6 digits
but i’m getting values like - ‘408760a2938a8332b2e45a7dbd5f6abfadf036af’

I guess I’ll have to follow @robkingston’s technique.
Do you have any idea on how to do that?

Can you paste the contents of your PII enrichment (with the salt removed)? If you have the PII enrichment the idea is to make this as non-reversible as possible without having the original value and the salt.

1 Like

I’d recommend having a look at the ‘Data generated’ section of the PII enrichment.

For values that go through the PII process they will be hashed in the canonical part of the payload and the enrichment will add a context containing the field, original value and hashed value that will then enable you to work backwards to the original data.

For your hash 408760a2938a8332b2e45a7dbd5f6abfadf036af given that we know it’s a 6 digit number and the salt is pepper123 we can assume the input is 5200 such that

SHA1("5200pepper123") == 408760a2938a8332b2e45a7dbd5f6abfadf036af

1 Like

I have a similar situation with decoding IP addresses, I tried with the same salt above but did not give me the desired result. Any idea on this?

Hi Joseph - are you able to start a new thread with what you’ve tried?

1 Like