Sync App Store Ads
ranksy ads copies your Shopify App Store ads data from Shopify Partners into Ranksy: campaigns, keywords, negative keywords, daily metrics, search terms, and the country, plan, and device breakdowns. Connect once, then run ranksy ads sync on a schedule.
Shopify has no public API for App Store ads, so the sync runs on your machine, in your own logged-in Partners session. In Ranksy, the data shows on App Store Ads.
ranksy ads connect # once: log in to Partners, map each Shopify app to a Ranksy app
ranksy ads sync # the last 3 complete days
Before you start
- Chrome. Partners sits behind Cloudflare and a captcha, so
ranksy adsopens a real Chrome window, and you log in yourself.ranksynever sees your Shopify password or cookies, and never fills in the login form. It looks forgoogle-chrome,google-chrome-stable,chromium, andchromium-browseron yourPATH. To use another binary, pass--chrome <path>or setCHROME_BIN. - An API key with the
integrations.managepermission.connectlists your Ranksy apps, which needs no permission, andsyncsends the data, which needsintegrations.manage. A key created before permissions needs theapps:readandads:writescopes instead. The key's team must own the Ranksy apps that you map. See Authenticate. ranksy0.8.0 or later to sync more than one Partners organization, and 0.9.0 or later to sync only some apps with--only-app. Runranksy update.
Connect
ranksy ads connect
connect opens Chrome on Shopify Partners and waits up to 10 minutes for you to log in. Then it lists the Shopify apps of the organization and asks which Ranksy app each one goes into. It pre-selects the app that is already mapped, or a Ranksy app with the same name. Choose Skip for a Shopify app that you don't want to sync.
Run connect again at any time to change the mapping of an organization. Apps that you skip lose their mapping, and the mappings of the other organizations stay as they are.
- If you belong to several Partners organizations,
connectasks which one to add. To pick it up front, pass--org <id>. The organization ID is the number in your Partners URL:partners.shopify.com/1234567/.... - The Chrome profile keeps the login, in the data folder under
partners-chrome. Later runs ofsyncreuse it, so you don't log in again until Partners ends the session. - Chrome runs with a remote-debugging port,
9333by default. If a Chrome already listens on that port,ranksyreuses it. To use another port, pass--port. To use another profile folder, pass--profile.
What connect saves
connect writes the [ads] table in the config file:
config.toml
[ads]
orgs = ["1234567", "7654321"]
[ads.apps.<shopify-app-api-key>]
ulid = "01HZX9ABCDEF" # the Ranksy app the ads go into
name = "Your App" # for people reading the file
org = "1234567" # the Partners organization of the app
orgs lists the connected organizations. A config file from before 0.8.0 has a single org = "..." key. It keeps working, and ranksy rewrites it as orgs the next time it saves the file.
Sync
ranksy ads sync
sync opens the same Chrome profile without a prompt, pulls the ads data from Partners day by day, and sends it to Ranksy. By default, it syncs the last 3 complete days, up to yesterday in UTC.
- Syncing again is safe. When
syncsends a day again, the new data replaces the old data for that day. An ads report that you uploaded as CSV for the same campaign and that overlaps a synced day is deleted, as a whole: the synced data wins. - By default, a sync covers every mapped app in every connected organization. To sync only some apps, see Sync only some apps. Shopify apps that you didn't map are skipped, with a message.
syncpulls the newest day first and sends the data in chunks of 7 days (--chunk-days), so recent data reaches Ranksy within minutes, even during a long backfill.- At the end,
syncprints the number of campaign-days, search terms, and breakdown rows stored for each app.
Run it on a schedule
sync asks no questions, so it can run from cron. Use -q to print only errors:
crontab
0 6 * * * ranksy ads sync -q
sync opens a normal Chrome window, not a headless one, so the machine needs Chrome and a display that Chrome can open a window on.
Several Partners organizations
If your Shopify apps live in more than one Partners organization, connect each organization once. Each connect adds an organization and keeps the others:
ranksy ads connect --org 1234567 # connect the first organization
ranksy ads connect --org 7654321 # add another; 1234567 stays connected
ranksy ads sync # sync every connected organization, one after another
ranksy ads sync --org 7654321 # sync only this organization
syncwithout--orgsyncs every connected organization in turn, in one Chrome window.- If one organization fails, for example because its Partners session expired,
syncstill syncs the others. It lists the failed organizations at the end and exits with code1. - To sync fewer apps, use
--only-app. See the next section. --orgwith an organization that you didn't connect fails, and the error lists the connected ones.
Sync only some apps
To sync one app, for example to backfill an app that you just connected without pulling your other apps again, pass --only-app:
ranksy ads sync --only-app "Your App" --from 2025-11-01 --to 2025-12-20
ranksy ads sync --only-app 01HZX9ABCDEF --only-app "Other App" # several apps
--only-apptakes the Ranksy app ID, the Shopify app ID (its API key, the key under[ads.apps]in the config file), or the Shopify app name. Names are not case-sensitive. Repeat the flag for several apps.syncskips every organization that has none of the apps. With--org, it syncs only the apps that are in that organization.- For each day,
syncstill pulls the campaign list of the whole organization, because Partners has no per-app version of it. It skips the country, plan, and device breakdowns, the search terms, and the keywords of the other apps, which are most of the requests. It sends nothing to Ranksy for the other apps. - A value that matches no mapped app fails before Chrome opens, with exit code
1, and the error lists the mapped apps. - The global
--appflag does not filtersync. Only--only-appdoes.
Disconnect
ranksy ads disconnect --org 7654321
disconnect removes the organization from orgs and deletes the app mappings of that organization from the config file. It makes no API call: the data that Ranksy already has stays in Ranksy. To sync the organization again, run ranksy ads connect --org 7654321.
Date ranges
Pick the days to sync with inclusive or exclusive bounds:
| Flags | Days |
|---|---|
| none | The last 3 complete days, up to yesterday (UTC). |
--days N | The last N complete days, up to --to or yesterday. |
--from D | From D up to yesterday. |
--from D --to E | From D to E, both included. |
--after D | The days after D, up to yesterday. |
--after D --before E | The days between D and E, both excluded. |
Dates use the YYYY-MM-DD format. You can't combine --after with --from, or --before with --to.
ranksy ads sync --from 2025-01-01 # backfill from a date up to yesterday
ranksy ads sync --from 2025-11-01 --to 2025-12-20 # inclusive range
ranksy ads sync --after 2026-01-31 --before 2026-03-01 # exclusive range: all of February
ranksy ads sync --days 14 # the last 14 complete days
Partners rate-limits hard. --concurrency sets how many days sync pulls at the same time. Keep it at 1, the default, unless you need speed.
Resume an interrupted backfill
sync writes each day that it pulls to the export folder, --out. The default is ads-export in the cache folder. Each organization gets its own subfolder:
<out>/1234567/campaigns.json # the campaign snapshot
<out>/1234567/2026-02-14.json # one raw export per day
If a long backfill stops, run the same command again with --resume. sync reads the days that are already in the export folder instead of pulling them from Partners again, and pulls only the missing days:
ranksy ads sync --from 2025-01-01 --resume
--resume skips only the pull. sync still sends every day in the range to Ranksy.
A day pulled with --only-app is saved as <date>.only.json, with the list of its apps, so a later sync of all apps never mistakes it for a full day and pulls that day again. A --resume with --only-app can reuse a full day file, or a .only.json file that covers every app that you asked for.
Dry run
ranksy ads sync --dry-run
--dry-run pulls the data from Partners and writes one payload file for each app and chunk (payload-<app>-<date>.json) to the export folder, but sends nothing to Ranksy. It needs no API key, and it includes Shopify apps that you didn't map. Use it to check what a sync would send.
Exit codes and failures
| Code | Meaning |
|---|---|
0 | Every organization synced, and every request to Ranksy succeeded. |
1 | At least one organization failed, or at least one request to Ranksy failed. The other apps and organizations still ran, and the failures are listed at the end. |
2 | Usage error, such as an invalid date. |
Troubleshooting
Partners session expired. The Partners login in the Chrome profile ended, or the captcha showed up again. Run ranksy ads connect --org <id> and log in again, then run sync.
Shopify Partners is not connected. Run ranksy ads connect first.
403 from Ranksy. The API key, or the member who created it, lacks the integrations.manage permission (or, on an older key, the ads:write or apps:read scope). Create a key with integrations.manage on the team that owns the apps.
404 from Ranksy. The mapped Ranksy app is not on the key's team. Run ranksy ads connect again to map the Shopify app to one of the team's apps.
skip "<app>": not mapped to a Ranksy app. The organization has a Shopify app that you didn't map. Run ranksy ads connect --org <id> to map it, or ignore the message.
What the CLI calls
For each mapped app, sync sends one request for each chunk of days:
POST /api/v1/apps/:app/shopify-ads/sync
The endpoint needs the integrations.manage permission (on an older key, the ads:write scope). Each request carries the daily data of the chunk; a very large chunk is split over several requests. The first request for an app also carries its campaign snapshot (settings, keywords, negative keywords, and Shopify's keyword recommendations) and Shopify's keyword ideas for the app. Ranksy compares each snapshot with the one it stored, and logs the differences in GET /apps/:app/shopify-ads/changes. The CLI waits up to 10 minutes for each response and retries 429 and 5xx errors like every other command. See Retries and timeouts.
This endpoint exists for the CLI, and this site does not document its request body.