• Resolved matssofts

    (@matssofts)


    We have installed this plugin and hooked it up to insert the tracking code into our website. However we noticed that the code that has been inserted is inside comment tags <!– –> which is preventing the tracking code from actually recording page views into Pardot. Is there a problem with your plugin? I cannot see anywhere in the settings where we activate the code in anyway. How do we resolve this issue and use your plugin as advertised – because at the moment it is not doing the main thing that it is supposed to do (track page visits).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Cliff Seal

    (@cliffseal)

    Hey @matssofts,

    Those HTML comment blocks are not actually preventing the JavaScript from working. Pardot tracking scripts still use an older (but still totally functional) format that ensures really old browsers properly interpret the script. You can see how our knowledge base article‘s code snippet has a similar type of comment at the beginning, and you can learn more about HTML comments in JavaScript via a quick Google. 🙂

    If you’re showing the campaign tracking code in your source on the front-end of your website, but aren’t seeing data, contact Pardot support.

    Thread Starter matssofts

    (@matssofts)

    Hi Cliff,
    Thank you for your response – but I would politely suggest that you are incorrect in some of the details.

    We did a test last night. We had the code that the plugin installed and code that we manually inserted on to the page running.

    Before we inserted the manual code into the pages – page views were not being tracked. We were getting page visits figures but it was not tracking page views – especially for people that we already knew. It was showing no activity – despite people actively using the website.

    After we inserted the manual code taken straight from the Pardot campaign screen we started to see those page views being registered.

    The only specific difference was that the tracking code was commented out.

    After a little more digging on the support channel for Pardot I also found this Pardot knowledge base article: http://help.pardot.com/customer/portal/articles/2125923 – the last section states that:
    “Also, make sure the tracking code is not commented out – the bolded tags prevent the tracking code from working: beginning: <!– Pardot Tracking Code –> <!– end: –> <!– End of Pardot Tracking Code –>”

    Therefore it would appear that the code that is inserted by the plugin will never work as it is inside comment tags – according to Pardot themselves.

    Thanks.

    Plugin Author Cliff Seal

    (@cliffseal)

    That article is mentioning something else, and I think has a formatting issue. I’ll pass that along to the right team.

    I totally understand the confusion, but <!-- and --> are not JavaScript comments, so they’re not commenting out the functionality. This plugin is successfully used by a lot of folks, including myself.

    Something else is going on, or there was a false positive with your testing somehow. I’d recommend checking in with Pardot Support. I’d also be happy to take a look and see if something else is causing a conflict—if you can send over the output of the campaign tracking code both from the plugin and manually, I can see if anything looks off.

    Thread Starter matssofts

    (@matssofts)

    Here are the two versions of the code. As you can see – the only difference as stated in the Pardot article is the <!– and –> HTML comments used inside the script tags. So in my understanding, because the script is inline on the page the HTML rendering is treating the actual script functions as being commented out – hence it does not execute the inline script functions and because you are missing some code from the javascript file then it does not recognise the last line of the code as being ignored. Perhaps I am wrong. But the code implemented is exactly what Pardot are suggesting doesn’t happen.

    Here is the code directly from the campaign settings:

    <script type="text/javascript">
    piAId = '340831';
    piCId = '2155';
    
    (function() {
    	function async_load(){
    		var s = document.createElement('script'); s.type = 'text/javascript';
    		s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
    		var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
    	}
    	if(window.attachEvent) { window.attachEvent('onload', async_load); }
    	else { window.addEventListener('load', async_load, false); }
    })();
    </script>
    

    Here is the code that is being inserted by the plugin:

    <script type="text/javascript">
    <!--
    piCId = '2155';
    piAId = '340831';
    
    (function() {
    	function async_load(){
    		var s = document.createElement('script'); s.type = 'text/javascript';
    		s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
    		var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
    	}
    	if(window.attachEvent) { window.attachEvent('onload', async_load); }
    	else { window.addEventListener('load', async_load, false); }
    })();
    -->
    </script>
    

    As stated – the tracking code appears to record page visits in the visitors section in Pardot – but when you go into a known prospect you are not seeing any page views apart from Pardot driven pages. Changing the code from plugin to Pardot sourced code fixed that problem – and that was the only change that was made.

    • This reply was modified 9 years ago by matssofts.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Why is the Pardot tracking code commented out?’ is closed to new replies.