Social Share Widget
Let users share your product on X (Twitter) and optionally reward them with discounts
Overview
The social share widget encourages users to share their experience with your product on X (Twitter). After sharing, they paste the tweet URL back into the widget to submit it as feedback. You can then verify the tweet in your dashboard and optionally grant a reward discount.
Shares appear in your feedback dashboard with source "Social Share" and type "Praise". Each tweet URL can only be submitted once — duplicates are automatically rejected.
Installation
Add the script tag where you want the widget to appear:
<script defer
src="https://seggwat.com/static/widgets/v1/seggwat-share.js"
data-project-key="your-project-key"
data-tweet-url="https://yourapp.com">
</script>Configuration
| Attribute | Description | Default |
|---|---|---|
data-project-key |
Your SeggWat project key (required) | - |
data-tweet-text |
Pre-filled tweet text (optional) | Empty |
data-tweet-url |
URL to include in the tweet | Current page URL |
data-tweet-hashtags |
Comma-separated hashtags (without #) | - |
data-button-color |
Button accent color | #1DA1F2 |
data-container |
CSS selector for inline placement | At script location |
data-subscription-id |
Subscription ID for reward eligibility | - |
data-language |
Language code (en, de, sv) |
Auto-detect |
data-version |
Version string for tracking | - |
data-show-powered-by |
Show "Powered by SeggWat" | false |
data-api-url |
Override API endpoint (for self-hosted) | Auto-detect |
How It Works
- User clicks "Share on X" — a new tab opens with a pre-filled tweet (or blank if no
data-tweet-textis set, so users write their own) - User posts the tweet on X
- User pastes the tweet URL back into the widget input field
- Widget submits the tweet URL as feedback with source "Social Share"
- You review the tweet in your dashboard and optionally grant a reward
Enabling Rewards
To enable the reward flow, the user's subscription ID must be provided. Without it, the share is still recorded as feedback but no discount can be granted.
Via HTML Attribute
<script defer
src="https://seggwat.com/static/widgets/v1/seggwat-share.js"
data-project-key="your-project-key"
data-tweet-url="https://yourapp.com"
data-subscription-id="sub_abc123">
</script>Via JavaScript
SeggwatShare.setSubscriptionId('sub_abc123');When a subscription ID is configured, a consent checkbox appears: "I'd like to be considered for a reward." The user must check this box for their subscription ID to be submitted with the share.
JavaScript API
// Set user ID for tracking
SeggwatShare.setUser('user-123');
// Enable reward eligibility
SeggwatShare.setSubscriptionId('sub_123');
// Reset widget to initial state (clears localStorage)
SeggwatShare.reset();State Persistence
The widget uses localStorage to remember when a user has already shared from a given page. After a successful submission, returning to the same page shows the success state immediately — preventing duplicate submissions and providing a consistent experience across page navigations.
Calling SeggwatShare.reset() clears this state.
Duplicate Prevention
Each tweet URL can only be submitted once across all users. If someone tries to submit a tweet URL that has already been recorded, the widget shows an error message. This is enforced server-side via a unique database index.
