Home > Knowledge Base > General instructions for CUX code installation

General instructions for CUX code installation

Introduction

CUX code is necessary to connect your site and CUX. The code makes sure the CUX database is always up to date and has the relevant pieces of information about visits, clicks, and visitor data. This is the only way to connect your site and CUX. When CUX script is operational on your site, and there’s traffic, you can safely assume that all the information you need is available on your CUX dashboard.

Before you start

  • Consider CUX installation using Google Tag Manager. That’s the least time-consuming approach. For more information, see Install CUX code with Google Tag Manager.
  • Make sure you can log in to your site using the administrative account.

The CUX code can be installed anywhere on the page. The recommended location for the script installation is before the closing BODY tag. This is just a recommendation. If you can’t do this, you can install the code, for example, before the closing HEAD tag.

           <div class="footer-copyright">
          <div class="container"> made with ♥️in Berlin | © cux.io 2019</span></div>
      </div>
    </footer>
	<script>(function(c,u,x,i,o){
      c._cuxSettings=c._cuxSettings||{id:o};
      var e=u.createElement(x),t=u.getElementsByTagName(x)[0];
      e.src=i;e.async=true;e.defer=true;t.parentNode.insertBefore(e,t);
      c._cux_q=[];c._cux=c._cux||{send:function(n,p){c._cux_q.push({n:n,p:p,t:new Date()})}};
    })(window, document, "script", "//dc.cux.io/analyzer.js?", "2056434044.0.70977600.1495720240.5926e130ad4cf");</script> 
  </body>
</html>

You can install the code anywhere on the page. It’s best to add the code before the tag. Here you have an example of how we did it on our website.

You may be tempted to install the code on a single page or just selected pages. We wholeheartedly do not recommend that. You won’t be able to observe the entire user journey, and you can miss a lot of valuable insights. Always install the CUX code for the entire site.

Install now 😁

There’s no need to wait. Code installation is the only thing you need to do to get everything running. There are no extra configuration or camera settings.

We’re convinced it shouldn’t be too difficult for you. In just several minutes, you should be able to see the first recordings and start thinking about your user behavior. And in case of problems, you can always talk to us!

Installing the CUX code

  1. Go to Profile >> Projects and click Show. This takes you to the project summary. You can find the code in a special box. It has a copy link that puts the entire CUX code in the clipboard.
  2. Log in to your site configuration panel. Use your admin credentials so that you can make changes in the site structure.
  3. Find the place where you can modify the site templates.
  4. Copy the tracking code from CUX.
  5. Switch to your site admin panel and paste the code in the HTML template.
  6. Save the template. If required, publish the changes.
  7. Verify if the code works. See, Checking if the code works

Checking if the code works

The easiest way to verify if CUX records visits on your site is to open several pages yourself. Load a page or two in your browser and go to the CUX dashboard. When the code operates and sends data to our database, you instantly see numbers on the dashboard. If the code installation instructions were displayed after you log in to CUX, they disappear the moment we record the first visit and make it ready for you to replay.

Where to find your CUX code

You can find the CUX code in the Projects section of the account menu. You can go directly to your current project list: https://app.cux.io/projects.

We also emailed the code to you when you set up the account.

CUX code is unique for each of your projects. This means you can’t reuse the same code on different sites. We generate the code when you create a new project. If you want to track multiple sites, you need a separate project for each of your sites.

The code seems not to work?

Here are some steps you can take to troubleshoot CUX connection:

  • Visit one of the pages where you installed the CUX code. We need to record at least one visit to show data.
  • Disable ad blocking. Browser extensions similar to Adblock prevent the CUX code from sending visit information.
  • Check if the code has been pasted on every page of your site. You can preview the source code of the page loaded in your browser. Search for cuxSettings string. If you can find it in your page code, this means the code is installed. Nothing helps? Let us know.

Next steps

  • Go to Visits. Start investigating the recordings as soon as they appear. For more information on visits, see Working with visits.
  • Go to Heatmaps. See user behavior. Understand what interests your users the most and see what catches their eye. For more information on heatmaps, see, What is a heatmap and what does it tell me?.