How to integrate ProfitMetrics with Lightspeed (C-Series)


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

  1. 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) -->
  2. Click "Instellingen"
    Edit Javascripts and Tracking Code in Website Settings - Step 2

  3. Click "Web-extras"
    Edit Javascripts and Tracking Code in Website Settings - Step 3
  4. Paste the code in "Custom javascript" > "Javascript"
    Edit Javascripts and Tracking Code in Website Settings - Step 7
Ensure the status is "Enabled"
Edit Javascripts and Tracking Code in Website Settings - Step 14

Part 2: How to install the setEmail script

  1. 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) -->
  2. Paste the "setEmail" script in "TRACKING" > "Tracking code"
    Edit Javascripts and Tracking Code in Website Settings - Step 12
  3. Ensure the status is "Enabled"Edit Javascripts and Tracking Code in Website Settings - Step 16

Part 3: How to install the for Klarna script (Optional)

  1. 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) -->
  2. Paste the Klarna Script script in "TRACKING" > "Tracking code"
    Edit Javascripts and Tracking Code in Website Settings - Step 12
  3. Ensure the status is "Enabled"Edit Javascripts and Tracking Code in Website Settings - Step 16
  4. 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