Skip to main content
Level 3
Jul 27, 2026 7:58 AM UTC
Question

Is there a mechanism to Encode and Decode URL params using AJO and WebSDK?

Hi community,

I have an use case to track the URL parameters via WebSDK and sendEvent with this params to AEP/AJO for Journey Triggers. 

However the challenge is that some of the URL params are needed to be encoded e.g. profile identity; Encoding via AJO should be feasible with helper functions, however I am not sure how can we implement decode logic at WebSDK level for the same identity. So that the incoming event from WebSDK can be stitched to the same identity, before sending any comm via AJO. 

Looking for your suggestions. 

 

2 replies

Level 4
Jul 28, 2026 10:55 AM UTC

Hi ​@ap95,

Good use case, the encode/decode split is actually the right mental model here, you just need to handle each side independently.

Decode at WebSDK (client side), before sendEvent:

JavaScript’s native decodeURIComponent() is your tool. Parse and decode the URL param before it goes into the XDM payload:

const params = new URLSearchParams(window.location.search);

const rawId = params.get('identity');

const decodedId = decodeURIComponent(rawId);

 

alloy("sendEvent", {

  xdm: {

    identityMap: {

      EMAIL: [{ id: decodedId, authenticatedState: "authenticated" }]

    }

  }

});

Decode before sending, never pass the encoded value into the identity map or AEP won’t stitch correctly.

Encode at AJO (outbound side):

Use AJO’s encodeURL() helper function in your message/journey expression editor when constructing the URL param that will land on your site. This ensures what you encode in AJO is what decodeURIComponent() unwraps on the client.

Identity stitching:

For the event to stitch to the same profile, the decoded value must match the identity namespace and value already in AEP’s Identity Graph (e.g. ECID, Email, CRM ID). Use the correct namespace in identityMap, if the param carries an email, use EMAIL; if it’s a CRM ID, use your custom namespace. The namespace mismatch is the most common reason stitching fails silently.

If the param carries sensitive data (e.g. full email in the URL): consider hashing it server-side and matching against a hashed identity in AEP instead of passing raw PII in query strings.

Translate
ap95Author
Level 3
Jul 29, 2026 7:23 AM UTC

Thanks ​@akhil_merupula , this is what I tried initially, however I noticed helper functions are throwing syntax errors when you use them to construct an URL. 

Syntaxes with Helper (tried using custom HTML block, as well as personalization editor):

<a href="https://dsn.adobe.com/web/a-7WZI?crmId={%= urlEncode(encode64(profile._tenant_partner.crmId))%}">
Preferences - With Base64 Encoding
</a>

<a href="https://dsn.adobe.com/web/a-7WZI?crmIdHash={%= sha256(profile._tenant_partner.crmId) %}">
Preferences - with HASH ID
</a>

For both, got the same syntax errors.
[
{
"type": "https://ns.adobe.com/aep/errors/CJMRT-071011-400",
"title": "Proof/Rendering failed due to some syntax errors related to personalisations in your content. Please check error details in Alerts section.",
"status": 400,
"report": {
"additionalContext": {
"errorList": "[{\"type\":\"https://ns.adobe.com/aep/errors/CJMTL-010030-422\",\"title\":\"Invalid value for the parameter originalUrl found at Position(2,11170) in url helper.\",\"status\":422,\"report\":{\"additionalContext\":{\"variantId\":\"703f940a-287e-4bfc-ba0c-41997ab84d02\",\"channel\":\"email\",\"source\":\"MESSAGE\",\"line\":\"2\",\"variantName\":\"default\",\"key\":\"originalUrl\",\"errorLevel\":\"ERROR\",\"position\":\"Map(line -> 2, column -> 11170)\",\"column\":\"11170\",\"helper\":\"url\"},\"tenantInfo\""}}}]",
"requestId": "aae58d90-8b19-11f1-555-eddb8581e48a-b127fc3-74bb0cd1"
}
}
}
]

 

Translate