Skip to main content

Link Templates

Cloud Feature

Link templates are a Cloud-only feature. Self-hosted Core deployments do not include templates — links are created directly with all fields specified. See Cloud vs Self-Hosted for details.

Link templates allow you to create reusable configurations for your short links, saving time and ensuring consistency across campaigns.

Overview​

Instead of filling in the same iOS URL, Android URL, attribution window, and UTM parameters for every link, create a template once and reuse it for all links in a campaign.

Benefits:

  • Save time - Fill in common values once
  • Ensure consistency - All campaign links have same configuration
  • Flexible overrides - Override any template value per link when needed
  • Team collaboration - Share templates across organization
  • Best practices - Enforce attribution windows, UTM structure
How Template Defaults Work

Templates provide default values that are automatically applied when creating links. However, you can override any template value on a per-link basis by providing a different value when creating the link. This gives you the flexibility of reusable templates while allowing exceptions when needed.

When to Use Templates​

Campaign Templates​

Create one template per marketing campaign:

Instagram Campaign Template:

  • iOS URL: Your App Store link
  • Android URL: Your Google Play link
  • Attribution Window: 7 days
  • UTM Medium: social
  • UTM Source: instagram

All Instagram links inherit these defaults. You only specify what's unique (the destination URL, campaign name).

Platform Templates​

Create templates for each traffic source:

  • Social Media Template - 7-day attribution, social UTM
  • Email Template - 3-day attribution, email UTM
  • Paid Search Template - 3-day attribution, CPC UTM
  • Display Ads Template - 30-day attribution, display UTM
  • Referral Template - 90-day attribution, referral UTM

Use Case Templates​

Create templates for common scenarios:

  • E-commerce Product Link - App Store URLs, product tracking
  • Content Deep Link - Article/video routing
  • Referral Link - Long attribution window, referral tracking
  • Event Promotion - Event-specific settings

Creating Templates​

Via Dashboard​

Step 1: Navigate to Templates

  1. Click Settings in sidebar
  2. Click Link Templates
  3. Click "Create Template" button

Step 2: Configure Template

Basic Settings:

  • Template Name: "Instagram Campaign"
  • Description: "Default template for all Instagram ads"

Platform URLs:

  • iOS URL: https://apps.apple.com/app/yourapp/id123456789
  • Android URL: https://play.google.com/store/apps/details?id=com.yourapp
  • Web Fallback URL: https://example.com/download

Attribution:

  • Attribution Window: 168 hours (7 days)

UTM Parameters:

{
"utm_medium": "social",
"utm_source": "instagram"
}

Step 3: Save Template

Click "Create Template". Template is now available when creating links.

Via API​

curl -X POST https://api.linkforty.com/api/templates \
-H "Authorization: Bearer $LINKFORTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Instagram Campaign",
"description": "Default template for Instagram ads",
"settings": {
"defaultIosUrl": "https://apps.apple.com/app/yourapp/id123456789",
"defaultAndroidUrl": "https://play.google.com/store/apps/details?id=com.yourapp",
"defaultWebFallbackUrl": "https://example.com/download",
"defaultAttributionWindowHours": 168,
"utmParameters": {
"medium": "social",
"source": "instagram"
}
}
}'

Response:

{
"id": "template_a1b2c3d4",
"name": "Instagram Campaign",
"slug": "x7k9m2p5",
"description": "Default template for Instagram ads",
"settings": {
"defaultIosUrl": "https://apps.apple.com/app/yourapp/id123456789",
"defaultAndroidUrl": "https://play.google.com/store/apps/details?id=com.yourapp",
"defaultWebFallbackUrl": "https://example.com/download",
"defaultAttributionWindowHours": 168,
"utmParameters": {
"medium": "social",
"source": "instagram"
}
},
"is_default": false,
"created_at": "2024-01-20T10:00:00Z",
"updated_at": "2024-01-20T10:00:00Z"
}

Using Templates​

Via Dashboard:

  1. Click "Create Link"
  2. Select template from "Template" dropdown
  3. Template values pre-fill the form
  4. Fill in unique values:
    • Original URL: https://example.com/product/123
    • UTM Campaign: spring-sale-2024
  5. Click "Create Link"

Via API:

curl -X POST https://api.linkforty.com/api/links \
-H "Authorization: Bearer $LINKFORTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"templateId": "template_a1b2c3d4",
"originalUrl": "https://example.com/product/123",
"utmParameters": {
"utm_campaign": "spring-sale-2024"
}
}'

Result: Link inherits iOS URL, Android URL, attribution window, utm_medium, and utm_source from template. You only provide the original URL and campaign name.

Overriding Template Values​

Override Behavior

You can override any template default value when creating a link. The backend applies this logic:

finalValue = userProvidedValue || templateDefaultValue || systemDefault

This means:

  1. If you provide a value when creating the link → your value is used
  2. If you don't provide a value → template default is used
  3. If template doesn't have a default → system default is used (e.g., 168 hours for attribution window)

Example: Override attribution window and UTM medium

curl -X POST https://api.linkforty.com/api/links \
-H "Authorization: Bearer $LINKFORTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"templateId": "template_a1b2c3d4",
"originalUrl": "https://example.com/special-promo",
"attributionWindowHours": 336,
"utmParameters": {
"campaign": "special-promo",
"medium": "influencer"
}
}'

Result:

  • Uses template's iOS/Android URLs (not overridden)
  • Uses template's utm_source (not overridden)
  • Overrides attribution window (14 days instead of template's 7 days)
  • Overrides utm_medium (influencer instead of template's social)
  • Adds new utm_campaign (special-promo)

Template Examples​

Social Media Template​

{
"name": "Social Media Default",
"description": "Template for all social media campaigns",
"settings": {
"defaultIosUrl": "https://apps.apple.com/app/id123",
"defaultAndroidUrl": "https://play.google.com/store/apps/details?id=com.app",
"defaultAttributionWindowHours": 168,
"utmParameters": {
"medium": "social"
}
}
}

Usage: Set utm_source per platform (instagram, facebook, tiktok, twitter) when creating links.

Email Campaign Template​

{
"name": "Email Campaign",
"description": "Template for email marketing",
"settings": {
"defaultIosUrl": "https://apps.apple.com/app/id123",
"defaultAndroidUrl": "https://play.google.com/store/apps/details?id=com.app",
"defaultAttributionWindowHours": 72,
"utmParameters": {
"medium": "email"
}
}
}

Usage: Set utm_source to email service (mailchimp, sendgrid) and utm_campaign to campaign name when creating links.

{
"name": "Google Ads",
"description": "Template for Google Ads campaigns",
"settings": {
"defaultIosUrl": "https://apps.apple.com/app/id123",
"defaultAndroidUrl": "https://play.google.com/store/apps/details?id=com.app",
"defaultAttributionWindowHours": 72,
"utmParameters": {
"medium": "cpc",
"source": "google"
}
}
}

Usage: Add utm_campaign and utm_term per ad group when creating links.

Referral Program Template​

{
"name": "Referral Program",
"iosUrl": "https://apps.apple.com/app/id123",
"androidUrl": "https://play.google.com/store/apps/details?id=com.app",
"attributionWindowHours": 2160,
"utmParameters": {
"utm_medium": "referral",
"utm_source": "friend"
}
}

Usage: Long 90-day attribution window for word-of-mouth referrals.

Content Marketing Template​

{
"name": "Blog Content",
"iosUrl": "https://apps.apple.com/app/id123",
"androidUrl": "https://play.google.com/store/apps/details?id=com.app",
"attributionWindowHours": 336,
"utmParameters": {
"utm_medium": "content",
"utm_source": "blog"
}
}

Usage: Moderate 14-day window for educational content.

Managing Templates​

List All Templates​

Via Dashboard:

Settings → Link Templates → View all templates

Via API:

curl -X GET https://api.linkforty.com/api/templates \
-H "Authorization: Bearer $LINKFORTY_API_KEY"

Response:

{
"templates": [
{
"id": "template_a1b2c3d4",
"name": "Instagram Campaign",
"description": "Default template for Instagram ads",
"iosUrl": "https://apps.apple.com/app/id123",
"androidUrl": "https://play.google.com/store/apps/details?id=com.app",
"attributionWindowHours": 168,
"utmParameters": {
"utm_medium": "social",
"utm_source": "instagram"
},
"createdAt": "2024-01-20T10:00:00Z"
},
{
"id": "template_e5f6g7h8",
"name": "Email Campaign",
"attributionWindowHours": 72,
"utmParameters": {
"utm_medium": "email"
},
"createdAt": "2024-01-15T09:00:00Z"
}
],
"total": 2
}

Update Template​

Via Dashboard:

  1. Settings → Link Templates
  2. Click template to edit
  3. Update fields
  4. Click "Save"

Via API:

curl -X PUT https://api.linkforty.com/api/templates/template_a1b2c3d4 \
-H "Authorization: Bearer $LINKFORTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Instagram Campaign (Updated)",
"attributionWindowHours": 336
}'

Important: Updating a template does NOT update existing links. Only new links created from the template will use new values.

Delete Template​

Via Dashboard:

  1. Settings → Link Templates
  2. Click template
  3. Click "Delete" button
  4. Confirm deletion

Via API:

curl -X DELETE https://api.linkforty.com/api/templates/template_a1b2c3d4 \
-H "Authorization: Bearer $LINKFORTY_API_KEY"

Important: A template can only be deleted when no links use it. Links are addressed by their template's slug (/<template-slug>/<code>), so the API refuses with TEMPLATE_HAS_LINKS while any remain. Move or delete those links first.

Advanced Strategies​

Template Hierarchy​

Create a base template and specialized variants:

Base Template: "Mobile App Default"

{
"name": "Mobile App Default",
"iosUrl": "https://apps.apple.com/app/id123",
"androidUrl": "https://play.google.com/store/apps/details?id=com.app",
"attributionWindowHours": 168
}

Variant 1: "Mobile App - Social"

{
"name": "Mobile App - Social",
"iosUrl": "https://apps.apple.com/app/id123",
"androidUrl": "https://play.google.com/store/apps/details?id=com.app",
"attributionWindowHours": 168,
"utmParameters": {
"utm_medium": "social"
}
}

Variant 2: "Mobile App - Paid"

{
"name": "Mobile App - Paid",
"iosUrl": "https://apps.apple.com/app/id123",
"androidUrl": "https://play.google.com/store/apps/details?id=com.app",
"attributionWindowHours": 72,
"utmParameters": {
"utm_medium": "cpc"
}
}

Campaign-Specific Templates​

Create template for each major campaign:

// Create campaign template programmatically
async function createCampaignTemplate(campaignName, source, attributionDays) {
return await fetch('https://api.linkforty.com/api/templates', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: `${campaignName} - ${source}`,
iosUrl: 'https://apps.apple.com/app/id123',
androidUrl: 'https://play.google.com/store/apps/details?id=com.app',
attributionWindowHours: attributionDays * 24,
utmParameters: {
utm_campaign: campaignName.toLowerCase().replace(/\s+/g, '-'),
utm_source: source
}
})
});
}

// Create templates for Q1 2024 campaign
await createCampaignTemplate('Spring Sale 2024', 'instagram', 7);
await createCampaignTemplate('Spring Sale 2024', 'facebook', 7);
await createCampaignTemplate('Spring Sale 2024', 'google', 3);

Team Templates​

Share templates across your organization:

  1. Admin creates templates with best practices
  2. Team members select from templates when creating links
  3. Ensures consistency across all campaigns
  4. Enforces attribution windows (e.g., always 7 days for social)

Dynamic Template Selection​

Select template based on traffic source:

const TEMPLATES = {
instagram: 'template_instagram',
facebook: 'template_facebook',
google: 'template_google',
email: 'template_email',
referral: 'template_referral'
};

function createLink(url, source, campaign) {
return fetch('https://api.linkforty.com/api/links', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
templateId: TEMPLATES[source],
originalUrl: url,
utmParameters: {
utm_campaign: campaign
}
})
});
}

// Automatically uses correct template
await createLink('https://example.com/product', 'instagram', 'spring-2024');

Best Practices​

Set up templates before launching campaigns. This ensures all links follow same structure.

2. One Template Per Traffic Source​

Create separate templates for each major traffic source:

  • Social media (Instagram, Facebook, TikTok, Twitter)
  • Paid search (Google, Bing)
  • Email
  • Display ads
  • Referrals
  • Content/organic

3. Include All Platform URLs​

Always set iOS, Android, and web URLs in templates. Don't make team members fill these in manually.

4. Set Appropriate Attribution Windows​

Match window to traffic source behavior:

  • Immediate channels (SMS, push): 1-6 hours
  • Direct response (search, email): 1-3 days
  • Social/content: 7-14 days
  • Brand awareness: 14-30 days
  • Referrals: 30-90 days

5. Use Consistent UTM Structure​

Establish UTM naming conventions in templates:

Good:

{
"utm_medium": "social",
"utm_source": "instagram"
}

Bad:

{
"utm_medium": "Social Media",
"utm_source": "Instagram Stories"
}

Use lowercase, no spaces, semantic naming.

6. Document Template Purpose​

Add clear descriptions:

{
"name": "Instagram - Stories",
"description": "Use for all Instagram Stories campaigns. 7-day attribution, social UTM tags."
}

7. Review Templates Quarterly​

Every 3 months:

  • Review attribution windows (are they optimal?)
  • Check if iOS/Android URLs changed
  • Update based on performance data
  • Remove unused templates

8. Limit Template Count​

Don't create too many templates. Aim for 5-10 core templates covering main use cases. Too many templates = confusion.

What to Put in Templates​

Template (consistent across campaign):

  • iOS/Android URLs
  • Attribution window
  • UTM medium
  • UTM source (for platform-specific templates)
  • Default targeting rules

Link (unique per link):

  • Original URL (destination)
  • UTM campaign
  • UTM content (ad variant)
  • Custom short code
  • Expiration date

Example​

Template: Facebook Ads Default

{
"iosUrl": "https://apps.apple.com/app/id123",
"androidUrl": "https://play.google.com/store/apps/details?id=com.app",
"attributionWindowHours": 168,
"utmParameters": {
"utm_medium": "cpc",
"utm_source": "facebook"
}
}

Link 1: Spring sale product page

{
"templateId": "template_facebook",
"originalUrl": "https://example.com/spring-sale",
"utmParameters": {
"utm_campaign": "spring-2024",
"utm_content": "carousel-ad-1"
}
}

Link 2: Summer sale product page

{
"templateId": "template_facebook",
"originalUrl": "https://example.com/summer-sale",
"utmParameters": {
"utm_campaign": "summer-2024",
"utm_content": "video-ad-1"
}
}

Both links share template defaults (platform URLs, attribution, medium/source), but have unique URLs and campaigns.

Comparison with Other Platforms​

FeatureLinkFortyAppsFlyerBranchAdjust
TemplatesUnlimitedLimited (Enterprise)No templatesNo templates
API AccessYesYes (Enterprise)LimitedLimited
Tier AvailabilityAll tiersEnterpriseN/AN/A
Team SharingYesYesNoNo
Override ValuesYesYesN/AN/A

LinkForty Advantage: Templates included free, unlimited templates, full API access.

Troubleshooting​

Template Not Appearing in Dropdown​

Cause: Template belongs to different organization.

Solution: Verify you're logged into correct organization.

Cause: Template was updated after link creation.

Solution: Template changes only affect new links. Update existing links manually or recreate.

Can't Delete Template​

Cause: Links still use the template (TEMPLATE_HAS_LINKS), or your role can't delete templates.

Solution: Move or delete the links that use it, then delete the template. Deleting templates requires the Owner or Admin role.

Next Steps​

API Reference​

Template endpoints (require Authorization: Bearer <token>):

  • GET /api/templates — List templates
  • POST /api/templates — Create a template
  • GET /api/templates/:id — Get a template
  • PUT /api/templates/:id — Update a template
  • DELETE /api/templates/:id — Delete a template
  • PUT /api/templates/:id/set-default — Set the default template