Adding center.js to Your Site

The center.js library identifies and tracks visitors to your websites so that you can trigger custom rules in Center based on their actions. To collect this data, you must install the tracking library on your site.

JavaScript Installation Snippet

When creating an integration for the Tracking Code in center, you will be presented with the Installation Snippet. This code should be added your website source code so that it renders in the <head> section of each page.

<script>
  (function(a,c,d,b,e,f){a[d]=b;a[b]||(a[b]=function(){a[b].q=a[b].q||[];a[b].q.push(arguments)},d=c.createElement(e),d.async=!0,d.src=f,c=c.getElementsByTagName(e)[0],c.parentNode.insertBefore(d,c))})(window,document,"LeadPagesCenterObject","center","script","https://js.center.io/center.js");
  center('create', 'YOUR_PID_GOES_HERE', 'SiteName', {
    captureEmailForms: true
  });
  center('SiteName.send', 'view');
</script>

Custom implementations may require modifying the commands in the JavaScript tracking snippet (the create and send commands) or adding additional code to track more interactions. However, you should not change the code that loads the center.js library or initializes the command queue.

Multiple Installation

The Tracking Code can be installed multiple times on the same site. The Tracking code will de-duplicate the installation and will only load center.js once.

Commands and events will be sent to the property specified in the command prefix. For example, the command YourSiteName.send will send the event only to the property identified as YourSiteName. If you want to send an event to all properties, you can omit the property name and call just send.