ActiveCampaign Forum

Can't submit UTM Params Via API

I’m using API v3 and using /contact/sync to update/create a contact

AC strips out my values for utm and does not update the contact with them (but other default fields work).

This is what I submit:
{
email: ‘someemail@test.com’,
utm_source: ‘facebook’,
utm_campaign: ‘doglovers’,
phone: ‘5128767176’
}

Phone updates just fine, but utm_source and utm_campaign are never updated in AC.

For context, we use multiple landing page software and some of them don’t accurately submit data to AC, so we have our own little server running to fill in the gaps. ie so Webpage->Server->Update contact utm params.

Any ideas on what I am doing wrong here?

Mark

I had the wrong endpoints. Here is the proper way to do it for anyone who might have the same issue:

try {
    let contact = await instance.post('/contact/sync', {
        contact: queryParams
    });

    //If there are any UTM params let's update Active Campaign with them
    for (const property in queryParams) {
        if (UTM_IDS[property]) {
            await instance.post(`/fieldValues`, {
                fieldValue: {
                    contact: contact.data.contact.id,
                    field: UTM_IDS[property],
                    value: queryParams[property]
                }
            })
        }
    }
    return contact;
} catch (err) {
    throw Error(err.error);
}