Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pr-title-suggestion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat(guides): track powered by amplitude footer clicks
193 changes: 193 additions & 0 deletions ACTION_REQUIRED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# ⚠️ ACTION REQUIRED: Footer Click Tracking Implementation

## Summary

This branch contains a **working workaround solution** for tracking clicks on the "Powered by Amplitude" footer in Guides & Surveys. However, the **proper long-term fix** requires access to the source repository for `@amplitude/engagement-browser`, which is not publicly available.

## What's Been Delivered

✅ **Workaround Solution** (`guides-footer-tracking.js`)
- DOM event delegation-based tracking
- Works without modifying engagement-browser source
- Can be deployed immediately
- Full documentation included

✅ **Documentation**
- `FOOTER_TRACKING_README.md` - Complete usage guide
- `QUICK_IMPLEMENTATION.md` - Step-by-step deployment
- `FOOTER_CLICK_TRACKING_SPEC.md` - Technical specifications
- `SOLUTION_SUMMARY.md` - Investigation summary

✅ **Examples & Tests**
- `examples/guides-footer-tracking-example.html` - Interactive demo
- `test/guides-footer-tracking.test.js` - Unit tests

## What's Missing

❌ **Source Repository Access**

The source code for the `@amplitude/engagement-browser` package could not be located in:
- amplitude/Amplitude-JavaScript
- amplitude/Amplitude-TypeScript
- Any public Amplitude GitHub repository
- NPM package (contains only compiled code)

The footer UI code is served from `https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz` but the source repository is private or not publicly accessible.

## IMMEDIATE ACTIONS REQUIRED

### Action 1: Deploy Workaround (Quick Fix)

**Who**: DevOps / Web Team
**Timeline**: Immediate (< 1 day)
**Steps**:
1. Copy `guides-footer-tracking.js` to Amplitude's web application
2. Include in pages that use guides/surveys
3. Initialize after Amplitude SDK loads
4. Verify events appear in Amplitude

**Code to add**:
```html
<script src="/static/guides-footer-tracking.js"></script>
<script>
window.AmplitudeGuidesFooterTracking.enableGuidesFooterTracking(amplitude);
</script>
```

### Action 2: Locate Source Repository

**Who**: Engineering Manager / SDK Team Lead
**Timeline**: Urgent (< 1 week)
**Required**:
- Identify where `@amplitude/engagement-browser` source code is maintained
- Grant access to engineer implementing the fix
- Possible locations:
- Private Amplitude GitHub repository
- Internal GitLab/Bitbucket
- Separate engagement/houston codebase
- Third-party vendor code

**Contact**:
- SDK maintainers: curtis@amplitude.com, nirmal@amplitude.com, sdk.dev@amplitude.com
- Search internal docs/wikis for "engagement-browser", "houston", "guides-surveys"

### Action 3: Implement Proper Fix

**Who**: Engagement SDK Engineer
**Timeline**: Short-term (1-2 weeks after source access)
**Required**:
1. Access to source repository (from Action 2)
2. Modify footer click handler to add tracking
3. Build and deploy updated bundle
4. Publish new npm version
5. Remove workaround

**Specific change needed**:
```typescript
// In the footer component (e.g., PoweredByFooter.tsx)
const handleClick = () => {
// ADD THIS:
analytics?.track('Guides Footer Clicked', {
destination_url: 'https://app.amplitude.com/guides-surveys',
component: 'powered_by_footer',
footer_text: 'Powered by Amplitude',
});

// EXISTING:
window.open("https://app.amplitude.com/guides-surveys", "_blank");
};
```

## Decision Points

### Should we deploy the workaround?

**YES, if**:
- You need tracking data immediately
- Source repository location unclear
- Low risk of conflict with future SDK updates

**NO, if**:
- Source repository access is imminent (< 1 week)
- Prefer to wait for proper fix
- Concerns about maintenance overhead

### How long to keep the workaround?

**Remove workaround when**:
- ✅ Proper tracking is implemented in engagement-browser source
- ✅ New version deployed to CDN
- ✅ New version adopted by Amplitude web application
- ✅ Verified events are tracked correctly
- ✅ Workaround script removed from deployment

## Success Criteria

### Workaround Success
- [ ] Script deployed to production
- [ ] Events appearing in Amplitude
- [ ] No console errors
- [ ] Footer still opens correct link

### Proper Fix Success
- [ ] Source repository located
- [ ] Tracking added to source code
- [ ] New version published
- [ ] Events tracked from built-in code
- [ ] Workaround removed
- [ ] No regression in functionality

## Risk Assessment

### Workaround Risks
- **Low**: Script adds minimal overhead
- **Low**: Uses standard DOM APIs
- **Medium**: May need updates if footer structure changes
- **Low**: Easy to remove when proper fix is ready

### No Tracking Risks
- **High**: Missing valuable product analytics
- **High**: Can't measure footer effectiveness
- **Medium**: Marketing impact unmeasured

**Recommendation**: Deploy workaround immediately while pursuing proper fix.

## Questions?

**For implementation help**:
- See `QUICK_IMPLEMENTATION.md`
- Check `FOOTER_TRACKING_README.md`
- Review example in `examples/guides-footer-tracking-example.html`

**For source code access**:
- Contact SDK team (sdk.dev@amplitude.com)
- Check with Engineering Manager
- Search internal docs for "engagement-browser" or "houston"

**For tracking questions**:
- Product team: Olly Smyth, lucas.h (from Slack thread)
- Check #guides-and-surveys-product-feedback channel

## Files in This Branch

1. `guides-footer-tracking.js` - Main tracking helper (workaround)
2. `FOOTER_TRACKING_README.md` - Complete documentation
3. `QUICK_IMPLEMENTATION.md` - Quick start guide
4. `FOOTER_CLICK_TRACKING_SPEC.md` - Technical specification
5. `SOLUTION_SUMMARY.md` - Investigation findings
6. `ACTION_REQUIRED.md` - This file
7. `examples/guides-footer-tracking-example.html` - Interactive demo
8. `test/guides-footer-tracking.test.js` - Unit tests

## Next Step

**CHOOSE ONE**:

**Option A - Quick Deploy** (Recommended)
→ Follow `QUICK_IMPLEMENTATION.md` to deploy workaround today

**Option B - Wait for Proper Fix**
→ Complete "Action 2" above to locate source, then "Action 3" to implement

**Option C - Both** (Best)
→ Deploy workaround now + implement proper fix in parallel
91 changes: 91 additions & 0 deletions CI_FIXES_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# CI Fixes Summary

## Status: 1 of 2 Failures Fixed ✅

### ✅ Fixed: ESLint + Prettier Violations

**Issue**: Unused variables in test file
- `mockDocument` was assigned but never used
- `mockWindow` was assigned but never used
- `elementStyle` was assigned but never used
- `event` parameter was defined but never used

**Fix Applied**: Removed all unused variables and parameters

**Verification**:
```bash
$ yarn lint
✓ All files pass ESLint
✓ All files pass Prettier
```

**Commit**: `045cdf1` - "fix: remove unused variables in footer tracking tests"

---

### ⚠️ Requires Manual Fix: PR Semantic Title

**Issue**: PR title doesn't follow [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/)

**Current Title**:
```
Amplitude footer click event
```

**Required Title** (choose one):
```
feat(guides): track powered by amplitude footer clicks
```
or
```
feat: add click tracking for guides footer
```

**How to Fix**:
1. Go to the PR on GitHub: https://github.com/amplitude/Amplitude-JavaScript/pull/623
2. Click "Edit" next to the PR title
3. Update to one of the suggested titles above
4. Save

**Why**: Amplitude uses semantic versioning based on conventional commit format in PR titles. The `feat:` prefix will trigger a minor version bump when this is merged.

**Note**: Automated update via `gh pr edit` failed due to permission restrictions (GraphQL: Resource not accessible by integration).

---

## CI Check Results After Fixes

### Expected Results:
- ✅ ESLint + Prettier: **PASS** (fixed in commit 045cdf1)
- ⚠️ PR Semantic Title: **PENDING** (manual update required)

### Verification Commands:
```bash
# Verify lint passes locally
yarn lint

# Check ESLint on specific files
npx eslint test/guides-footer-tracking.test.js --no-ignore
npx eslint guides-footer-tracking.js --no-ignore

# Check Prettier
npx prettier --check guides-footer-tracking.js test/guides-footer-tracking.test.js
```

All commands should pass ✅

---

## Summary

**Fixed Automatically**:
- Removed unused variables from test file
- Removed unused event parameter
- All ESLint checks now pass
- All Prettier checks now pass

**Requires Manual Action**:
- Update PR title on GitHub to follow `feat(scope): description` format
- Suggested: `feat(guides): track powered by amplitude footer clicks`

Once the PR title is updated, all CI checks should pass.
Loading
Loading