G to your account tab, from there click on to Account Settings and find campaign URL settings:
function main() {
var adGroupIterator = AdsApp.adGroups().withCondition("CampaignStatus = ENABLED").get();
while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
var gn=adGroup.getName().replace(/\s/g,'_');
var cn=adGroup.getCampaign().getName().replace(/\s/g,'_');
adGroup.urls().setCustomParameters({adgroup: gn, campaign: cn});
console.log(gn)
}
}
Now go to “” and replace
{lpurl}?utm_term={keyword}&utm_campaign={_utmcampaign}&utm_source=adwords&utm_medium=ppc&hsa_acc=3359597595&hsa_cam={campaignid}&hsa_grp={adgroupid}&hsa_ad={creative}&hsa_src={network}&hsa_tgt={targetid}&hsa_kw={keyword}&hsa_mt={matchtype}&hsa_net=adwords&hsa_ver=3
with:
{lpurl}?utm_source=google&utm_medium=cpc&utm_campaign={_campaign}&utm_adgroup={_adgroup}&utm_term={keyword}&placement={placement}
Note that if the lower level tracing URL will be defined, the top level (account) will not trigger on this campaign/group.
https://www.marcinwsol.pl/blog/tagowanie-reczne-manualne-sposoby-dodawania-oraz-automatyzacji/?fbclid=IwAR2B6-p-4xwCg1bV1Gq-5Ihavnup-wBxYXBbXw9Tz5Rc7WPkksV6NCAsEbU
https://ga-dev-tools.web.app/ga4/campaign-url-builder/
https://developers.google.com/google-ads/scripts/docs/getting-started