Knowledge Base      


What if my Page Builder won’t work with the Campaigns Website Code?


With the vast majority of the Page Builders out there, you can easily add our Campaigns Click Tracking or Conversion Tracking code to the <head> or <body> of your web pages.

There are, however, a couple of buggy Page Builders that need special care. For these Page Builders, we have an alternative form for our Campaigns Click Tracking or Conversion Tracking code that’s uglier and longer but works exactly the same this as our normal code.

If you’ve found that your Page Builder adds Tracking or Conversion code to your page twice even though you’ve added it in just one place, or your Page Builder strips out or adds additional <script> tags, then this code is for you.


Alternative Click Tracking Code

Here is the alternative Click Tracking code that you would use for your landing page. Just copy this code exactly as you see it and paste it into your Page Builder:

<script>
    if (typeof clickmagick_cmc === 'undefined') {
        var clickmagick_cmc = {
            uid: '[USERID]',
            hid: '[HID]',
        }

        ;(function(d) {
            var s = d.createElement('script');
            s.async = true;
            s.src = 'https://cdn.clkmc.com/cmc.js';
            var fs = d.getElementsByTagName('script')[0];
            fs.parentNode.insertBefore(s, fs);
        })(document);
    }
</script>



Alternative Conversion Tracking Code

For the alternative Conversion Tracking Code, you’ll need to take the Click Tracking Code above and do a little bit of editing to create the Conversion Tracking Code.

The easiest approach is to first create the standard Campaign Conversion Tracking code for an Action, Engagement, or Sale from the Campaigns dashboard, then take the alternative Click Tracking Code you see above and replace everything between these lines:

var clickmagick_cmc = {
   ...

}

with the lines you see in the Campaigns dashboard.

For example, if the Campaign Conversion Code that you see in the Campaigns dashboard looks like this …

<script>
    var clickmagick_cmc = {
        uid: '[USERID]',
        hid: '[HID]',
        cmc_goal: 'a',
        cmc_ref: 'salesvideo',
     }
</script>
<script src='//cdn.clkmc.com/cmc.js'></script>


… you would copy the lines of code between the { and } characters and replace those lines in the Click Tracking Code at the top of the page to create this new piece of Conversion Tracking Code:

<script>
    if (typeof clickmagick_cmc === 'undefined') {
        var clickmagick_cmc = {
            uid: '[USERID]',
            hid: '[HID]',
            cmc_goal: 'a',
            cmc_ref: 'salesvideo',
        }

        ;(function(d) {
            var s = d.createElement('script');
            s.async = true;
            s.src = 'https://cdn.clkmc.com/cmc.js';
            var fs = d.getElementsByTagName('script')[0];
            fs.parentNode.insertBefore(s, fs);
        })(document);
    }
</script>

 
Caution: When you edit this code, do NOT use a word processor or a “rich text” editor that automatically replaces straight quotes with curly quotes. In other words replacing these straight quotes 'with these curly quotes  will break your code. You MUST use a “plain text” editor, or better still, just edit the code in the entry box of your Page Builder which should always work.
 

If your Page Builder automatically adds the <script> and </script> tags, or it breaks when you include them, simply remove those two lines from this alternative code when you enter the code into the Page Builder.

If you have any trouble making these edits, please submit a ticket to the Helpdesk.

Article 755 Last updated: 11/15/2021 8:20:33 AM
https://www.clickmagick.com/kb/?article=755