Free ActiveCampaign Contact scoring with AppsScript

Free ActiveCampaign Contact scoring with AppsScript

MeasureSchool

6 лет назад

3,706 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@timodnl
@timodnl - 16.11.2019 22:52

I think the automation needs to be set to run multiple times (not once as was shown in the demo) if you want it to increment each time the user opens a campaign email? (triggering it from the contact record bypasses that condition/restriction - or at least it seems to be the case in my testing)

Ответить
@rhonings
@rhonings - 11.08.2019 23:50

SOLVED
==========
Looks like the script or AC did not like %BESTELD% (6 letters). As soon as I changed it to %ORDER% (only 5 letters) it worked. I have no clue why but it works now.
==========


Hi Julian, thanks for this. I have it up and running. Now I want to add a second script to keept rack of the number of orders. I have copied your script and changed "score" into "besteld". Added the webhook to AC (plus ?besteld=1). When I check the script in Google it says it ran succesfully. But in AC the field "besteld" is not updated. The field "besteld" is added to all lists in AC. Below is the code I have used, Anyone has any clue why this happens?


//read incoming data
function doPost(e) {
return getAantalBestellingen(e);
}




function getAantalBestellingen(e){


var contactEmail = e.parameter["contact[email]"];
var addScore = e.parameter.besteld;
var currentScore = e.parameter["contact[fields][besteld]"] || 0;
try{
//calculate new score
var updateScore = parseInt(currentScore) + parseInt(addScore);


var bodyData = [];

//push data for the body parameters
bodyData.push(
['api_key' , API], //api_key
['api_action' , 'contact_sync'],
['api_output' , 'json'],
['email' , contactEmail],
['field[%BESTELD%]', updateScore]
);

//map data from array and build payload
var body = bodyData.map(function(el){el[1] = encodeURIComponent(el[1]); return el.join('=')}).join('&'); //joing payloadData into a query string


//send data to AC
var options =
{
'method' : 'POST',
'payload' : body,
'contentType': 'application/x-www-form-urlencoded'
};



var response = UrlFetchApp.fetch(URL+"/admin/api.php", options); //send data to AC
//print out response
return ContentService.createTextOutput(response.getContentText());
}catch(e){
return ContentService.createTextOutput(e);
}
};

Ответить
@valeriorossi1679
@valeriorossi1679 - 12.11.2018 20:10

I get a NaN in ActiveCampaign. Any suggestions please?

Ответить
@jamessilberman3004
@jamessilberman3004 - 19.02.2018 21:56

This is brilliant, thanks! One further question: Once I have the script running, is there a way to sort my contacts by score or do I have to go into each contact's profile to see their score?

Ответить
@giuseppecasavola1623
@giuseppecasavola1623 - 15.09.2017 21:38

work only with field "score" or is possible to add other goal fields?

Ответить
@HanafiHazemi
@HanafiHazemi - 05.09.2017 06:07

Thanks.. that is really useful. Please keep it up!

Ответить
@iMurasev
@iMurasev - 22.07.2017 20:15

FU$$$NG AWESOME! Man you're boy genius!

Ответить
@andrewmcbride88
@andrewmcbride88 - 20.07.2017 06:32

More Google Scripts and Active Campaign please. So helpful and functional.

Ответить
@alexandrosfar
@alexandrosfar - 19.07.2017 20:02

Awesome, thanks a lot for this and for the value you add with all of your videos!

Ответить
@nickliberati4890
@nickliberati4890 - 19.07.2017 19:37

Awesome stuff, Julian, as always. If I had a custom field: count_of_logins
how would I modify the script to work with that field?

Ответить
@KarmaSenge
@KarmaSenge - 19.07.2017 18:14

Can you do this with Clickfunnels?

Ответить
@wowgetthis
@wowgetthis - 19.07.2017 16:22

This is really cool. Thank you so much!

Ответить