CCFish (Cocos Creator 2.4.15, iOS bundle com.snngames.seafishshooter, version 2.0.0) cracked organic user acquisition by embedding a referral engine directly into its fishing game loop. It works because sharing rewards are tied to gameplay power-ups, not external incentives — every share makes the player stronger in the water. The result is a self-reinforcing growth loop where player engagement and acquisition feed each other.

The Growth Challenge

Mobile gaming CPI for casual titles now averages $5.12 on iOS, with fishing and hyper-casual genres ranging from $3.80 to $6.50 per install depending on geo and creative quality. For a mid-core casual title like CCFish, relying solely on paid UA narrows the LTV-to-CAC ratio with every auction cycle. CCFish needed to grow the player base without tripling ad spend. The answer was a referral system baked into the Cocos Creator client that leverages social sharing mechanics and is instrumented for end-to-end viral coefficient tracking. The system had to be lightweight to avoid bloating the Cocos Creator build and reliable enough to handle iOS share sheet edge cases.

The Referral Architecture

CCFish operates a three-tier referral system that rewards both referrer and referred player at increasing commitment levels:

| Tier | Trigger | Reward (Referrer) | Reward (New User) |

|------|---------|-------------------|-------------------|

| 1 | First install via referral link | 50 Gold Coins + 1 Lucky Hook | 100 Gold Coins + Starter Pack |

| 2 | Referred player reaches level 10 | 150 Gems + 3 Rare Lures | — |

| 3 | Referred player makes first IAP | 20% of IAP value as Gems | 10% bonus on first purchase |

Each player gets a unique `referral_code` generated via a deterministic hash of `player_id` with a server-side salt. Share links follow this format:

```

https://cc.fish/join?ref=CCF7X9K2&campaign=organic_referral_v2

```

On first app launch after install, the Cocos Creator client reads the `ref` query parameter via the iOS deep link handler. The referral association is posted to a Cloudflare Workers backend that validates, deduplicates, and rewards:

```javascript

async function handleReferralClaim(request) {

const { new_player_id, referral_code, source_ip } = await request.json();

if (!/^[A-Z0-9]{7}$/.test(referral_code)) {

return new Response(JSON.stringify({ error: 'invalid_code' }), { status: 400 });

}

const referrer = await REFERRAL_MAP.get(referral_code);

if (!referrer) {

return new Response(JSON.stringify({ error: 'code_not_found' }), { status: 404 });

}

const deviceKey = `device:${source_ip}:${new_player_id}`;

const alreadyClaimed = await DEVICE_CLAIMS.get(deviceKey);

if (alreadyClaimed) {

return new Response(JSON.stringify({ error: 'already_claimed' }), { status: 409 });

}

await REFERRAL_ATTRIBUTION.put(new_player_id, JSON.stringify({

referrer_id: referrer.id, referral_code, claimed_at: Date.now(), tier: 1

}));

await awardRewards(referrer.id, { gold: 50, lucky_hook: 1 });

await awardRewards(new_player_id, { gold: 100, starter_pack: true });

return new Response(JSON.stringify({ success: true }));

}

```

The share-to-unlock mechanic drives the viral loop. Players who share their referral link to WhatsApp, Telegram, or iMessage receive a Golden Rod power-up that boosts catch rate by 30% for 15 minutes. This creates a natural cadence: share → play with boosted stats → catch more rare fish → share again. The Golden Rod is consumed on use, so players have an ongoing incentive to keep sharing.

Implementation Details

The referral flow integrates at three points within the Cocos Creator 2.4.15 codebase:

**1. iOS Deep Link Handler** — The JavaScript layer registers a custom URL scheme via the Cocos-to-Objective-C bridge using `jsb.reflection.callStaticMethod`. When a referral link opens the app, the `cc.systemEvent` listener extract the `ref` parameter and displays a welcome banner with the referrer’s username and reward preview.

**2. Cloudflare Workers Backend** — Three endpoints running on Workers with D1 for relational data and KV for fast lookups:

| Endpoint | Method | Purpose | Cache Strategy |

|----------|--------|---------|----------------|

| `/api/referral/code` | GET | Return player's referral code | Edge TTL 3600s |

| `/api/referral/claim` | POST | Record install + award rewards | No cache |

| `/api/referral/stats` | GET | Return dashboard analytics | Edge TTL 300s |

**3. Share-to-Unlock Gate** — Premium in-game items like exclusive rods and rare bait types are gated behind a share action. The client triggers the native iOS share sheet and applies the Golden Rod boost on completion:

```javascript

// ShareToUnlock.js

shareToUnlock: function(itemId) {

const shareText = `Join me on CCFish! 🎣 Use my referral link`;

const shareUrl = `https://cc.fish/join?ref=${this.referralCode}&item=${itemId}`;

if (cc.sys.isNative) {

jsb.reflection.callStaticMethod('ShareManager',

'presentShareSheet:url:', shareText, shareUrl);

}

Analytics.track('referral_share', { item_id: itemId, code: this.referralCode });

this.applyTemporaryBoost('golden_rod', 900);

}

```

Measuring Viral Growth

Every share, install, and conversion feeds into a viral growth model. The primary metric is the **k-factor** (viral coefficient):

```

k = invites sent per player × conversion rate per invite

```

CCFish tracks this per install-week cohort using a Redshift-backed pipeline:

```sql

SELECT DATE_TRUNC('week', install_date) AS cohort_week,

COUNT(DISTINCT referrer_id) AS active_referrers,

SUM(invites_sent) AS total_invites,

SUM(converted_installs) AS converted_installs,

ROUND(SUM(converted_installs) / NULLIF(SUM(invites_sent), 0), 3) AS conversion_rate,

ROUND((SUM(invites_sent) / COUNT(DISTINCT referrer_id)) *

(SUM(converted_installs) / NULLIF(SUM(invites_sent), 0)), 3) AS k_factor

FROM referral_facts

WHERE install_date >= '2025-01-01'

GROUP BY 1 ORDER BY 1;

```

Cohort analysis revealed a key insight: players who complete tier 1 (first referral install) have a 3.4× higher likelihood of referring additional players. This drove the team to optimize the share-to-unlock mechanic as the primary activation trigger — getting that first referral across the line became the north star metric for the growth team.

Results

Six months of referral data from version 2.0.0:

| Metric | Value |

|--------|-------|

| Total referral-driven installs | 84,700 |

| Share-to-unlock completion rate | 62% |

| Average invites per active player | 3.8 |

| Viral coefficient (k-factor) | 0.31 |

| Tier 2 conversion rate | 14% |

| Tier 3 conversion rate | 3.2% |

| Effective CPI saved | $4.30 per referral install |

At k=0.31, every 100 players generate 31 new players organically. While below the viral threshold of 1.0, this compounds significantly over time. Over six months, the referral channel contributed approximately 22% of total new installs, reducing the blended CPI from $5.80 to $3.90. The share-to-unlock mechanic was the highest-leverage feature — players who engaged with it shared 4.2× more invites than those who didn’t.

Key Takeaways

1. **Embed referral in the core loop.** The share-to-unlock mechanic ties sharing to gameplay power-ups, making referral feel like part of the game rather than an interruption.

2. **Instrument every step.** Without tracking the full funnel from share to install to tier completion, the team wouldn’t have identified tier 1 as the critical activation event that drives the entire viral loop.

3. **Serverless backend scales.** Cloudflare Workers with D1 and KV handled the referral load with near-zero operational overhead. At peak, the three endpoints process approximately 2,000 requests per minute with p99 latency under 150ms.

4. **Real rewards drive retention.** The three-tier system gives referrers ongoing incentive to keep their referrals engaged through level 10 and beyond. Tier 2 rewards create a retention loop that benefits both the referrer and the game’s overall DAU.

5. **Viral growth complements paid UA.** At k=0.31, organic referrals don’t replace paid acquisition, but they lower the blended CPI by 33%. Data on which ad channels produce users with the highest referral probability feeds back into marketing spend allocation — creatives that attract sharers get increased budget.

CCFish’s referral engine proves that in a market where CPI keeps climbing, the most cost-effective install is the one your existing players deliver. By aligning game mechanics with growth mechanics, the team built an acquisition channel that scales with engagement rather than budget.