Skip to content

Adding Custom Data

Set userId to track users across sessions and devices:

window.appziSettings = {
userId: "user_abc123",
};

This enables:

  • Response tracking across sessions
  • “User is logged in” targeting rules
  • Duplicate survey prevention

Use userCreationDate to target surveys by account age:

window.appziSettings = {
userId: currentUser.id,
data: {
userCreationDate: "2024-01-15", // ISO 8601 format
},
};

This enables targeting like “show NPS to users older than 30 days”.

You can customize certain Appzi behaviors using the global variable appziSettings.

The simplest way to define it is by adding a <script> tag in the <head> of your HTML:

<head>
<!-- .... -->
<script>
window.appziSettings = {
/// options
};
</script>
</head>

To attach additional metadata to feedback submissions, use the 📖 FeedbackData property.

The feedback will use the label value (if provided) when displaying the field. If no label is given, the field name (key) will be used instead.

Example:

window.appziSettings = {
data: {
someText: "text",
"camel-case-number": 5,
booleanValue: false,
labeledValue: {
value: "test",
label: "Some Test Label",
},
},
};

Include user information to segment and analyze feedback:

window.appziSettings = {
data: {
userId: "user_12345",
subscription: {
value: "premium",
label: "Subscription Plan",
},
accountAge: "30 days",
},
};

Add technical context to help troubleshoot problems:

window.appziSettings = {
data: {
appVersion: "2.4.1",
environment: "production",
browserFeatures: {
value: "webgl,websockets",
label: "Browser Features",
},
},
};

Set data based on the current user state:

const user = getCurrentUser(); // Your function
window.appziSettings = {
data: {
userId: user.id,
plan: user.subscriptionPlan,
accountCreated: {
value: user.createdAt,
label: "Account Created",
},
},
};

Do not include:

  • Passwords or authentication tokens
  • Credit card numbers or payment information
  • Social security numbers or national IDs
  • Personal health information

Best practices:

  • Only include data necessary for feedback context
  • Use user IDs instead of names or emails when possible
  • Ensure compliance with GDPR, CCPA, and privacy regulations
  • Be transparent with users about what data you collect
  • Maximum fields: 50 fields per submission
  • Maximum field size: 1000 characters per value
  • Recommended total size: ~10KB or less

Keep data structures simple and include only information you’ll actually use for analysis.