ETLMCPData Conveyance Works
Log in Start free
Guides

Renamed campaigns: why history splits and how to keep it together

Why a renamed campaign shows up as two lines in your reports, and how to total it by campaign_id and label it with its latest name.

A campaign that is renamed splits into two lines whenever a report groups by campaign_name: the days stored before the rename carry one label and the days after carry another. The fix is to total by campaign_id, which does not change when you rename, and then attach one label per id, normally the name on its most recent day. Two further traps follow from the same rename: UTM tags built from Meta's name macros can keep the old name, and in GA4 data the user counts on the day of the rename come out empty.

Why the split happens

Every row etlmcp writes carries both an id and a name for the campaign, side by side in the campaign_id and campaign_name columns, along with a network column that says which platform the row came from. Each row is a snapshot of one day. A sync re-pulls a recent window and replaces only the rows of that pipeline inside the dates it covered; rows for older days stay exactly as they were stored. So once a rename is older than the window your platform re-pulls (for Meta, the last 29 days when the connector is available), the table holds old-name rows for the earlier days and new-name rows for the later ones, and nothing will make them agree.

A GROUP BY campaign_name, pivot table or BI chart treats those as two campaigns: daily numbers stay correct, but the campaign total is cut in two.

For Meta, when the connector is available, it treats a row without a campaign id as an error instead of storing it, so every Meta row has an id you can group on.

Total by id, label with the latest name

In PostgreSQL, take one name per campaign from its most recent date, then join it back. This query works on the table the PostgreSQL destination writes; replace ads_daily with your table's name:

WITH latest_name AS (
  SELECT DISTINCT ON (network, account_id, campaign_id)
         network, account_id, campaign_id, campaign_name
  FROM ads_daily
  ORDER BY network, account_id, campaign_id, date DESC
)
SELECT n.network, n.campaign_id, n.campaign_name,
       SUM(a.cost)        AS cost,
       SUM(a.clicks)      AS clicks,
       SUM(a.conversions) AS conversions
FROM ads_daily AS a
JOIN latest_name AS n USING (network, account_id, campaign_id)
GROUP BY n.network, n.campaign_id, n.campaign_name
ORDER BY cost DESC;

Keep network and account_id in the key when one table holds several platforms or accounts, so that ids from different platforms or accounts never mix. In a BI tool the same idea applies: make the id the grouping field and show the name as a label looked up from the latest day, rather than putting the name on the axis.

Platform-specific fields sit in columns named extra.<field>. The PostgreSQL destination keeps the dot in the column name, so you quote it: SUM(a."extra.sessions").

Meta URL tags can keep the old name

If your UTMs are built with Meta's {{campaign.name}}, {{adset.name}} or {{ad.name}} macros, a rename in Ads Manager does not necessarily reach your analytics. Meta's URL tags guide explains that it stores the names in a snapshot when an object is first published, and that name macros read from that snapshot rather than from the current name. Traffic from a renamed campaign can therefore arrive in Google Analytics still labelled with the original name, while the cost rows from Meta show the new one.

The id macros, {{campaign.id}}, {{adset.id}} and {{ad.id}}, have no such snapshot behaviour described. Putting {{campaign.id}} into a URL parameter gives you a value that survives renames. Google's URL builder page lists utm_id as the campaign ID parameter, separate from utm_campaign, which carries the readable name. For Google Ads, see ValueTrack for UTMs.

GA4: keyed on id, but users go empty on the rename day

When the GA4 connector is available, it asks Google Analytics for the session's campaign ID as well as its campaign name, and it builds each row's key from the date, the campaign ID and the source / medium. A rename therefore does not split a day into two rows: if Google returns one campaign ID under two names for the same day, etlmcp adds the two together and keeps one of the names. Only when Google gives no campaign ID does the name stand in as the key, and it is then written to campaign_id as well.

The cost of that merge is total_users and new_users. Users are distinct counts that cannot be added, so on a merged row both are left empty. Sessions, views, key events, orders and revenue are still summed. If a campaign shows sessions but blank users on one day, look for a rename on that date. Across days, the stored campaign_name can still differ, so the id-and-latest-name query above applies to GA4 tables too. The details of the merge are on GA4 campaigns renamed during a day, and why user counts never sum is covered in GA4 users and sessions.

Related

Sources

  1. Use URL Tags for Tracking — developers.facebook.com, checked
  2. URL builders: Collect campaign data with custom URLs — support.google.com, checked