Can we Enrich existing value in javascript enrichment

Hi
we are still using pubsub Enricher 2.0.5 can we update values from entities and context which is coming from event for example
user_id came as hased can we unhased it and saved back in same entity

we are using old version on snowplow like

  • snowplow-enrich-pubsub-2.0.5
  • snowplow-stream-collector-google-pubsub-2.4.5
  • snowplow-bigquery-streamloader-1.1.0
  • snowplow-bigquery-mutator-1.1.0

can we update only Enicher to latest one .does it effect other components or we have update whole pipeline

Hi @Jitender_Attri
I’m not quite sure if I understood your question correctly, but I’ll give it a try:

In general it is possible to manipulate standard event fields, contexts/entities or unstruct events with the JavaScript Enrichment. One exception are derived contexts that means contexts which are generated by enrichments (e.g. the cookie or header enrichment).

You can find multiple examples in the documentation. Example for the user_id field:

function process(event) {
  if (event.user_id != null) {
    event.setUser_id('foo');
  }

  return [];
} 

However, the hashed user_id use case you mentioned probably won’t work since hashing is a one way function. “unhashing” would only be possible with a rainbow table for all hashed user_ids, which might not be a good idea.

Unfortunately I cannot answer your question regarding the update of the enrich component.
Hope that help.
David

2 Likes

My Question is can we update unstruct event and Context data of events in tracker which is coming in event using snowplow-enrich-pubsub-2.0.5

Yes - with the exception of derived_contexts as David has mentioned above.