Skip to content

Instantly share code, notes, and snippets.

View sanrai's full-sized avatar

Sanjay Rai sanrai

View GitHub Profile
@sanrai
sanrai / gist:82d3fd7dd4613c23364f4f1f0d8ff584
Created November 22, 2024 15:50
XLG Attribution Dashboard Automation - Engineering Design Doc

XLG Attribution Dashboard Automation - Engineering Design Doc

High-Level Approach

  • Use Adobe Target APIs to fetch all activities and their audience information
  • For activities using AEP-sourced audiences:
    • Extract activity details (ID, name, type, dates, status)
    • Capture audience names
  • Use AEP APIs to map audience names to their XLG/AEP IDs
  • Output data in required Excel format for dashboard ingestion
// Base64 encoding function
function base64Encode(uint8Array) {
let binary = '';
const len = uint8Array.length;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(uint8Array[i]);
}
return btoa(binary);
}
// URL-safe character set for Base85 encoding (now with 85 characters)
const URL_SAFE_CHARS = [
// Digits (10)
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
// Uppercase letters (26)
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
// Lowercase letters (26, including 'z')
// Base85 encoding function using BigInt
function base85Encode(bytes) {
const ASCII85_CHARS = Array.from({ length: 85 }, (_, i) => String.fromCharCode(i + 33));
let output = '';
let i = 0;
while (i < bytes.length) {
let chunkSize = Math.min(4, bytes.length - i);
let value = BigInt(0);
for (let j = 0; j < chunkSize; j++) {
// Base85 encoding function using BigInt
function base85Encode(bytes) {
const ASCII85_CHARS = Array.from({ length: 85 }, (_, i) => String.fromCharCode(i + 33));
let output = '';
let i = 0;
while (i < bytes.length) {
let chunkSize = Math.min(4, bytes.length - i);
let value = BigInt(0);
for (let j = 0; j < chunkSize; j++) {
function base85Encode(input) {
const ASCII85_CHARS = Array.from({ length: 85 }, (_, i) => String.fromCharCode(i + 33));
const encoder = new TextEncoder();
const bytes = encoder.encode(input);
let output = '';
let i = 0;
while (i < bytes.length) {
let chunkSize = Math.min(4, bytes.length - i);
let value = 0;