# Team: Adstify Internal

## Platform Focus

This team primarily clones Shopify and Next.js product pages for performance marketing campaigns.

---

## Additional Tracking to Remove (Shopify-specific)

Beyond the master list, also remove:
- `window.Shopify.SignInWithShop?.initShopCartSync` — triggers `/cart.js` fetches
- `window.Shopify.featureAssets` — loads shop-cart-sync, checkout-modal
- Kaching Bundles app block (`shopify://apps/kaching-bundles`) and its `kaching-loader.js`
- Cloudflare email-decode (`/cdn-cgi/scripts/.../email-decode.min.js`)
- Any `shopify://apps/` embed blocks that are purely functional (cart, upsell, checkout)
- Taboola pixel (archive-digger.com/assets/script_tag.js, taboolaId)
- Elevate A/B testing (elevateab.app.txt, ds0wlyksfn0sb.cloudfront.net)
- Shoplift A/B testing (`<!-- Start of Shoplift scripts -->` ... `<!-- End of Shoplift scripts -->`)
- Okendo tracking calls (keep Okendo CSS/widget HTML for visual fidelity)

---

## Next.js Sites

**Detect:** page HTML contains `__NEXT_DATA__`, `__next_f`, `/_next/static/`, or `_next/` in script src.

**wget adjustment:**
```bash
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent --reject "*.map" -P [job-folder] [URL]
```

**Never remove these scripts:**
- `<script id="__NEXT_DATA__" type="application/json">` — kills hydration if removed
- `<script src="/_next/static/...">` — framework chunks
- Any inline script referencing `__NEXT_F`, `__NEXT_P`, `__webpack_require__`, or `webpackChunk`

**Keep `_next/` at job root** — do not move into `assets/`. References to `/_next/` become `_next/` (relative).

**Fix subpath references** (sites hosted under e.g. `/breezebox/`):
```bash
# Fix turbopack chunk loader
grep -rl '/[subpath]/_next/' _next/static/chunks/
sed -i 's|"/[subpath]/_next/"|"_next/"|g' _next/static/chunks/turbopack-*.js

# Blank the page chunk base variable
grep -rl 'e="/[subpath]"' _next/static/chunks/
sed -i 's|e="/[subpath]"|e=""|g' _next/static/chunks/[page-chunk].js
```

Also fix `index.html` inline `__next_f` blocks:
```python
content = content.replace('/[subpath]/_next/', '_next/')
content = content.replace('/[subpath]/', '/')
```

After blanking `e`, grep for `${e}/...` patterns and download those assets from origin.

**`/api/` 404s are expected** — document in `ERRORS.md`.

---

## GemPages Pages (Shopify App)

**Detect:** page HTML contains `gp_lazyload`, `gps-link`, `base-src`, or `gp-global.js`.

Fix the broken `A()` function in `assets/js/gp-lazyload.js`:

**Find:**
```
let A=(e,t)=>{try{e.startsWith("http://")||e.startsWith("https://")||(e="https://"+e);let n=new URL(e);return n.searchParams.delete(t),n.toString()}catch(t){return console.error("Error occurred while removing query by key:",t),e}}
```

**Replace with:**
```
let A=(e,t)=>{try{var isRel=!e.startsWith("http://")&&!e.startsWith("https://");var base=isRel?window.location.origin+"/"+e.replace(/^\//,""):e;let n=new URL(base);n.searchParams.delete(t);return isRel?n.pathname.replace(/^\//,"")+n.search+n.hash:n.toString()}catch(t){return console.error("Error occurred while removing query by key:",t),e}}
```
