Reference

Snippet Reference

Full API documentation for the Nudgify JavaScript snippet.


Installation

Paste the snippet before the closing </body> tag in your app's HTML. Your developer does this once — after that, you manage everything from the dashboard.

index.html
<!-- Add before closing </body> tag -->
<script src="https://nudgify.app/snippet" async></script>
<script>
  Nudgify.init("proj_xxxxxxxxxxxx");
</script>

Replace proj_xxxxxxxxxxxx with your project key from the Settings page.


Methods

Nudgify.init(projectKey, options?)

Initializes the snippet. Call once on page load, before identify(). After this, Nudgify evaluates targeting rules and shows matching flows.

projectKeystringrequired

Your project API key from the Settings page.

options.hideWatermarkboolean

Hides the 'Powered by Nudgify' badge. Available on paid plans.

Nudgify.identify(user)

Optional. Pass user properties to enable plan-based and session-based targeting. Call after your user logs in. It's safe to call init() before identify() — Nudgify re-evaluates rules when identify() is called.

Nudgify.identify({
  id: "user_123",        // your user's unique ID
  plan: "free",          // "free" | "pro"
  session_count: 3,      // how many times they've logged in
  role: "admin",         // optional
});
idstring

Your user's unique ID from your database.

planstring

"free" | "pro" — used in upgrade-prompt targeting.

session_countnumber

How many sessions this user has had. Target first-timers or power users.

rolestring

Optional role string — e.g. "admin" | "viewer".

Nudgify.reset()

Clears all shown-flow state in localStorage. Useful for testing — lets you see flows again without creating a new user.

Nudgify.reset();

Events tracked automatically

Nudgify tracks these events automatically and sends them to your analytics dashboard. Events are batched and sent every 5 seconds, or immediately on page unload.

flow_shown

The flow was displayed to the user.

step_advanced

User clicked the CTA button to advance to the next step.

flow_completed

User finished the last step (or clicked a Complete action).

flow_dismissed

User closed the flow early via the ✕ button.

Ready to install?

Copy your snippet from Settings and paste it into your app.

Go to Settings →