Part 1: How to install the script
Part 2: How to install the setEmail script
Part 3: How to install the setEmail script within Klarna Checkout
Part 1: How to install the script
- Copy the snippet below and replace PUBLIC_ID with your actual Public ID (How to find your Public ID)
<!-- Start ProfitMetrics - snippet - (v1) -->
<script>
window.profitMetrics = {
pid: 'PUBLIC_ID',
emailInputSelector: '#gui-form-customer-email, #gui-form-email',
onLoad: () => {
const email = '';
if (email && email.includes('@') && email.includes('.') && !/\s/.test(email)) {
profitMetrics.setEmail(email);
}
}
}
</script>
<script src="https://cdn1.profitmetrics.io/PUBLIC_ID/bundle.js" defer></script>
<!-- End ProfitMetrics - snippet - (v1) --> -
Click "Instellingen"
- Click "Web-extras"
- Paste the code in "Custom javascript" > "Javascript"
Part 2: How to install the setEmail script
- Copy this snippet
<!-- Start ProfitMetrics - setEmail - (v1) -->
<script>
function _pm_tryemailorderconfirmation() {
if( null != window.profitMetrics && null != window.profitMetrics.setEmail && typeof window.profitMetrics.setEmail === 'function' ) {
window.profitMetrics.setEmail( '' );
} else {
setTimeout( _pm_tryemailorderconfirmation, 500 );
}
}
_pm_tryemailorderconfirmation();
</script>
<!-- End ProfitMetrics - setEmail - (v1) --> - Paste the "setEmail" script in "TRACKING" > "Tracking code"
- Ensure the status is "Enabled"
Part 3: How to install the for Klarna script (Optional)
- Copy this snippet
<!-- Start ProfitMetrics - KlarnaCheckout - (v1) -->
<script>
if (typeof window._klarnaCheckout === 'function'){
window._klarnaCheckout(function(api) {
api.on({
'change': function(data) {
profitMetrics.setEmail(data.email);
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'event': 'klarnaCheckout',
'klarnaCheckout': {'email':data.email}
});
}
});
});
}
</script>
<!-- END ProfitMetrics - KlarnaCheckout - (v1) --> - Paste the Klarna Script script in "TRACKING" > "Tracking code"
- Ensure the status is "Enabled"
- If your Hybrid Server-side Universal Integration Script is set up through Google Tag Manager, you will need to create a DataLayer variable with the value below and insert it in the Email field within the ProfitMetrics Tag.
klarnaCheckout.email