Комментарии:
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)
Ответить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);
}
};
I get a NaN in ActiveCampaign. Any suggestions please?
Ответить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?
Ответитьwork only with field "score" or is possible to add other goal fields?
ОтветитьThanks.. that is really useful. Please keep it up!
ОтветитьFU$$$NG AWESOME! Man you're boy genius!
ОтветитьMore Google Scripts and Active Campaign please. So helpful and functional.
ОтветитьAwesome, thanks a lot for this and for the value you add with all of your videos!
Ответить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?
Can you do this with Clickfunnels?
ОтветитьThis is really cool. Thank you so much!
Ответить