--- title: "Adding Web Analytics, Conversion Tracking, Completion Tracking or Custom Javascript" slug: "adding-web-analytics-conversion-tracking" updated: 2026-11-23T12:33:17Z published: 2026-11-23T12:33:17Z canonical: "support.gainsight.com/adding-web-analytics-conversion-tracking" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.gainsight.com/llms.txt > Use this file to discover all available pages before exploring further. # Adding Web Analytics, Conversion Tracking, Completion Tracking or Custom Javascript IMPORTANT **The functionality described in this article is not applicable to the Skilljar Starter package.** Add your own analytics and tracking systems to your Skilljar courses on the [Theming page of your Skilljar dashboard](http://dashboard.skilljar.com/themes/). In this article, we'll cover topics such as cookie policy code snippets and global, conversion, and conversion tracking codes. ## Adding analytics and tracking codes You can add code snippets to your Skilljar dashboard using these steps: 1. Open your Skilljar dashboard and select **Themeing**, or expand the **Themeing** header on the left and then select **Themes**. 2. Select the theme you want to manage from the list. 3. Scroll down and select the **Code Snippets** header to reveal the snippet fields. 4. Add your desired code snippets, and when you're finished, select **Save and Continue** or **Save** to apply them. ### Code Snippet fields ![Screenshot showing Code Snippet fields](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/17177506905491.gif?sv=2026-02-06&spr=https&st=2026-11-24T17%3A22%3A59Z&se=2026-11-24T18%3A22%3A59Z&sr=b&sp=r&sig=aBJMH34SdblHw73F9W0vCt9i2UtXRnS2EA6OMLI3puc%3D) - **Global Title** - String input, which loads as Metadata in the of every webpage on your training site. - **Cookie Policy Code Snippet** - Loads before the on each webpage in your training site. This should only be used for cookie management tools that need to load before cookies can be set on your web pages. - **Analytics Tracking Code Snippet** - Used for analytics tracking. You can still use the Global Head Snippet, but this field makes managing your analytics tracking code easier. - **Global Head snippet** - Loads in the on each webpage in your training site. This snippet is the best place for styling (CSS). - **Global Code Snippet** - Loads after the of each webpage in your training site and is the best place for scripts (JS), which changes data that has loaded as a part of the page. - **Conversion Code Snippet** - The code in this snippet runs after a learner purchases a course or enrolls in a free one. It's used for Javascript integrations that need to trigger when a student registers for a course. - **Course Completion Snippet** - The code in this snippet runs after a learner has completed a course and is used for Javascript integrations that need to trigger when the learner has completed a course. ## Cookie policy code snippet The Cookie Policy Code Snippet can be used to install Cookie Management Systems, which will load before the HEAD section of the webpage. ![The Cookie Policy Code Snippet can be used to install Cookie Management Systems, which will load before the HEAD section of the webpage.](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/360092743334.png?sv=2026-02-06&spr=https&st=2026-11-24T17%3A22%3A59Z&se=2026-11-24T18%3A22%3A59Z&sr=b&sp=r&sig=5EruxO%2BLhEQdSodygOST7KfTspR1aXLn7zy5hjLmImc%3D) If you use tools such as [OneTrust](https://www.onetrust.com/), [Cookie Snippet](https://cookie-script.com/), and [Osano](https://www.osano.com/) to load a Cookie Management System on your training domain, you can use this snippet location for those JavaScript tools. ## Global Tracking Codes To add the code to ALL pages, paste your snippet into the field titled "Global code snippet". Here are links to locate common snippets: - [Google Analytics](https://support.google.com/analytics/answer/1008080?hl=en) - [Google Tag Manager](https://developers.google.com/tag-manager/quickstart) - [Segment.io](https://segment.io/docs/tutorials/quickstart-analytics.js/#step-1-copy-the-snippet) - [Mixpanel](https://mixpanel.com/help/reference/javascript) - [Marketo](http://developers.marketo.com/documentation/websites/lead-tracking-munchkin-js/) - [Hubspot](http://knowledge.hubspot.com/getting-started-with-hubspot/how-to-install-the-tracking-code-on-a-generic-website) - [Intercom](https://www.intercom.com/help/en/articles/175-set-up-event-tracking-in-intercom) - [ExactTarget (Salesforce Marketing Cloud)](https://help.salesforce.com/s/articleView?id=mktg.mc_wa_web_analytics_connector.htm&type=5) - [Heap](https://developers.heap.io/docs/web) - [Matomo](https://developer.matomo.org/guides/tracking-javascript-guide) ## Conversion Tracking Codes You can also add custom tracking to registrations. This is frequently used to track conversions from marketing campaigns or to send lead data to customer relationship management (CRM) systems. Just paste the snippet into the field titled 'Conversion code snippet'. Please note that you may need to add tags around the snippet if they are not present by default. Here are links to locate common conversion tracking snippets: - [Marketo](http://developers.marketo.com/documentation/websites/lead-tracking-munchkin-js/) - [Google AdWords](https://support.google.com/adwords/answer/1722054) - [Google Analytics Events](https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#SettingUpEventTracking) - [Facebook Ads](https://www.facebook.com/help/435189689870514/) - [Twitter Ads](https://support.twitter.com/articles/20170807-conversion-tracking-for-websites) - [Segment.io](https://segment.io/docs/libraries/analytics.js/#track) - [ExactTarget (Salesforce Marketing Cloud)](https://help.salesforce.com/s/articleView?id=mktg.mc_wa_web_analytics_connector.htm&type=5) ## Conversion Tracking Codes - Advanced Javascript For advanced users, we include several Javascript variables within the page which you can use as optional parameters within your code snippets. Here are the variables we currently support. Please let us know if you would like to see additional fields tracked. The lesson parameter is only present within the skilljarCourse object when viewing a lesson page. To include lesson information in your tracking, you'll need to make sure it exists in the skilljarCourse object first. Additionally, the skilljarUser variable only exists when a user is signed into the system. Pageviews by unauthenticated users will not contain a skilljarUser variable. ```plaintext var skilljarUser = {    id: '2qd4gf6abc7d8',    email: 'jane@example.com',    name: 'Jane Doe',    firstName: 'Jane'    lastName: 'Doe' }; var skilljarCourse = {    id: 'x24tgec3bed2',    title: 'Your Course Title',    tags: ["Tag name 1", "Example Tag 2", "Example Tag3"],    lesson: {        id: 'y35uhfd4cgf2e',        title: 'Your Lesson Title'    } }; var skilljarPurchase = {    type: 'COURSE_ENROLLMENT',    quantity: 1,    orderId: '41X6G94W',    currencyCode: 'USD',    price: 25.00 }; ``` If a user bulk-purchases a course, the skilljarPurchase's type attribute will be type: 'BULK_PURCHASE' and the quantity attribute will represent the number of registrations purchased. If a user purchases access to a domain, the type attribute will be type: 'DOMAIN_ACCESS', with additional attributes such as 'domain'. Browser and document Javascript objects are also supported, such as page URL. An example Segment.io event might look as follows: ```plaintext ``` ## Completion Tracking Codes You can also add custom tracking to course completions. Just paste the snippet into the field titled 'Completion code snippet'. The course completion code snippet is run by injecting it into the page that the student is on when a course is completed successfully. When the browser runs this javascript snippet, it has access to the skilljarUser, skilljarCourse, and skilljarCourseProgress variables on the page: ```plaintext var skilljarUser = {    id: '2qd4gf6abc7d8',    email: 'jane@example.com',    name: 'Jane Doe' }; var skilljarCourse = {    id: 'x24tgec3bed2',    title: 'Your Course Title',    tags: ["Tag name 1", "Example Tag 2", "Example Tag3"],    lesson: {        id: 'y35uhfd4cgf2e',        title: 'Your Lesson Title'    } }; var skilljarCourseProgress = {    successStatus: 'PASSED' // or 'FAILED', can also be 'NULL' if there is no course score }; ``` The skilljarCourseProgress variable will show as PASSED or FAILED only if a lesson is set as the course score, other it will return as null. ## Additional Resources - [Sending Data to Segment](/v1/docs/sending-data-to-segment) - [Sending Data to HubSpot](/v1/docs/sending-data-to-hubspot) - [Sending Data to Marketo](/v1/docs/sending-data-to-marketo) - [Sending Data to Totango](/v1/docs/sending-data-to-totango) - [Sending Data to Influitive](/v1/docs/sending-data-to-influitive) - [Sending Data to Eloqua](/v1/docs/sending-data-to-eloqua) - [Sending Data to Gainsight PX](/v1/docs/sending-data-to-gainsight-px) - [Sending Data to Pendo](/v1/docs/sending-data-to-pendo) - [Sending Data to Amplitude](/v1/docs/sending-data-to-amplitude) - [Sending Data to MixPanel](/v1/docs/sending-data-to-mixpanel) - [Sending Data to Google Analytics](/v1/docs/sending-data-to-google-analytics)