analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXX-XX', 'auto');
When evaluating the code for inclusion, first confirm that the code does not contain any calls to document.write. If you see anything like document.write, you should avoid including this code, as this is likely old tracking code and is not intended to work with modern browsers and platforms.
Once you have prepared the tracking code, you can embed this code into the /shared/build.xslt template file, which can be edited through the File Editor by clicking on the file name. You will want to place the code just above the </head> closing tag. This will ensure that the script loads at the beginning of the page load, which may be necessary for conversion events later.
Many analytics platforms, including Google Analytics and Google AdWords, provide the capability to register "conversion events" based upon certain user actions. These may include starting or submitting an application, submitting a request for information form, etc. For example, you may have a Google AdWord that directs users to a landing page with a call to action to sign up onto your mailing list. To gauge the efficacy of these advertisements, and to take advantage of Google AdWord's built-in optimization capabilities, you may want to embed specific conversion code based upon an event, such as signing up onto the mailing list.
First, you will need to create the conversion code. In Google AdWords, you may receive code that looks like the following:
var google_conversion_id = 1234567890;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "XXX";
var google_conversion_value = 1.000000;
var google_remarketing_only = false;
You will need to identify what within Slate should trigger this action. If, for example, you want the conversion event to fire when a respondent submits a form, you can create a custom "Confirmation Page" onto which this code can be embedded.
When you access the form through the administrative system in Slate, you can click the "Communications" button to retrieve the list of configured communications, including upon registration emails that may be sent. If you want the same message to be emailed and shown in the browser, you can create or edit any existing "upon registration" communication. You can also, if desired, create a custom "confirm page only" communication.
Embedding the Code in Communications
Next, click the "Source" icon in the toolbar and paste the conversion code that you have.
You may receive a warning message about script tags when you add this code to your confirmation page. You can ignore this as long as your communication is set to "Confirmation Page Only," as the warning message is only relevant for email communications.
That's it! Upon submitting the form, the confirmation page will be displayed and the conversion code will be loaded and executed. These same techniques can be applied elsewhere throughout Slate, including in the online application, which is largely editable through the Application Editor.
Embedding the Code in the Form Description
You can also track when someone accesses the form, you can add the Facebook pixel code to the form's description, just before the closing </head> tag in the source code: