THIS ARTICLE WILL HELP YOU:
Use this setup to track ClickFunnels conversions with Convert using a webhook, since you can't add any snippets to their conversion pages.
Setup Instructions
First, add hidden fields to your ClickFunnels form with the following name:
- input-cid
- input-pid
- input-vid
- input-goals
- input-vars
- input-exps
- input-defaultsegments
Then add the following code to your Convert > Project > Configuration > Global Javascript section. Change:
- The URL where the form is located. This requires for the Convert snippet to be added to the form.
- The conversion goal id. You should get the id from the goal that you have created to track the conversion.
- The selectors for the input elements for the hidden fields you created on your ClickFunnels form. The selectors to replace are formatted with bold format on the code.
document.addEventListener('DOMContentLoaded', function(event) {
// Check if the current URL is 'https://www.domain.com/form.html'
if (window.location.href === 'https://www.domain.com/form.html') {
let session_cookie = convert.getCookie('_conv_s');
if ((JSON.stringify(convert.currentData.experiments) !== '{}' ||
JSON.stringify(convert.historicalData.experiments) !== '{}') &&
session_cookie) {
let conversion_goal_id = '100232282';
let session_id = session_cookie.substring(
session_cookie.lastIndexOf('sh:') + 3,
session_cookie.lastIndexOf('*')
);
let exp_list = [];
let variation_list = [];
let varID;
const processExperiments = (experiments) => {
for (let expID in experiments) {
varID = experiments[expID].variationId;
if (!exp_list.includes(convert.data.experiments[expID].id)) {
exp_list.push(convert.data.experiments[expID].id);
variation_list.push(varID);
console.log(
'Adding experiment: ' +
convert.data.experiments[expID].id +
':' +
varID
);
}
}
};
if (convert.currentData) {
processExperiments(convert.currentData.experiments);
}
if (convert.historicalData) {
processExperiments(convert.historicalData.experiments);
}
// Replace the corresponding selectors to the input element for the hidden fields that you added
document.getElementById("input-86550").firstElementChild.setAttribute('value', convert.data.u_id);
document.getElementById("input-62411").firstElementChild.setAttribute('value', convert.data.prj.id);
document.getElementById("input-96249").firstElementChild.setAttribute('value', session_id);
document.getElementById("input-91627").firstElementChild.setAttribute('value', conversion_goal_id);
document.getElementById("input-74759").firstElementChild.setAttribute('value', variation_list);
document.getElementById("input-18985").firstElementChild.setAttribute('value', exp_list);
document.getElementById("input-38478").firstElementChild.setAttribute('value', JSON.stringify(convert.getDefaultSegments()));
}
}
});
Then create two webhooks on ClickFunnels triggered when the transaction or contact creation occurs. These webhooks should set of type JSON on the ClickFunnels interface.
The endpoints for the webhooks should be:
https://webhooks.convert.com/s1/clickfunnels
https://webhooks.convert.com/s1/clickfunnels/test
Alternatively, you can create a webhook directed to Zapier and relay the conversion from there.
Troubleshooting
- Make sure that the input fields are filled with the data when the form is rendered. This should include your customer id, project id, and other related fields filled in.Test always in a fresh incognito session.
- Make sure you are part of the test, before firing the Conversion. Only then will the conversion be shown on the Live Log or the report. You can find out if you are part of a test, if you type convert.currentData.experiments in the console. The returned object should show the id's of the experiment that which you are part of.