Skip to content

Implement and Verify Code

Abstract

This document is a guide to implement and verify WOGAA Tracking Code v2 on your site

Warning

Do not reshare this document with anyone unless they need to implement WOGAA tracking on their websites


Latest Version

The latest version of WOGAA Web Analytics Tracking code is on WOGAA.JS v2.


Overview

The WOGAA Tracking Code needs to be implemented within your site in order to start collecting data which provides information about your website and visitors.

This guide will take you through the steps to setup and verify the tracking code implemention for testing in a Test Environment (for e.g. Staging) and Production Environment (Live deployment) respectively.

  1. Implement and Verify Code in Test Environment
  2. Implement and Verify Code in Production

Attention

In order to ensure the integrity of data collected, please ensure that you use the Correct Tracking Code for your Production and Non-Production (such as Development, QA, Staging - whichever applicable) environments.


To Get Started

As a best practice, you should test the code on your staging environment before deploying it on your production environment.

In the following sections we will take you through the steps to setup both your staging and production environments.


Implement and Verify Code in Test Environment

Step 1. Register your Test Environment

  • To register your test environment you will need to login to wogaa.sg
  • Navigate to the specific Information Service under the Manage Services tab
  • Select the Test Environment tab
  • Select Register Test Environment to register your respective test environment's domain/URL

Screenshot 2019-11-25 at 6 23 40 PM

  • After registration, proceed to Step 2 to insert tracking code into your registered environment.

Step 2. Insert Tracking Code

Click on Copy to Clipboard to insert the following Tracking Code into the <head> section of every page of your website, before other scripts.

<script src="https://assets.dcube.cloud/scripts/wogaa.js"></script>

Example

<html>
    <head>
        ...
        <script src="https://assets.dcube.cloud/scripts/wogaa.js"></script>
    </head>
    ...
</html>

Info

The base code does not support subresource integrity (SRI). Please do not enable SRI for base code.

Content Security Policies for Staging

Info

This step is optional if your website doesn't have Content Security Policy enabled.

If your website has Content Security Policy enabled, update your CSP with the following code:

default-src 'self' https://*.dcube.cloud/ https://*.demdex.net/ https://cm.everesttech.net/ https://wogadobeanalytics.sc.omtrdc.net/;
frame-src 'self' https://wogaa.demdex.net;
script-src 'self' blob: https://*.dcube.cloud https://assets.adobedtm.com/;
img-src 'self' data: https://wogadobeanalytics.sc.omtrdc.net/ https://cm.everesttech.net/ https://dpm.demdex.net/;
connect-src 'self' https://*.dcube.cloud https://dpm.demdex.net/;
style-src 'self' 'unsafe-inline' https://assets.dcube.cloud/fonts/;
font-src 'self' data: https://assets.dcube.cloud/fonts/;

Step 3. Verify Test Environment(s) for e.g. Staging

Once you have implemented the tracking code correctly, you will need the Chrome extension Snowplow Chrome Extension to verify if your base code is working correctly.

  1. Install Snowplow Chrome Extension
  2. On Chrome, navigate to the website with the base code installed.
  3. Right-click on the page and click Inspect
  4. Inside the Inspect console, click on the Snowplow Tab, image of snowplow tab in console
  5. Refresh the page where the base code is installed, or navigate to a few tabs and see that Pageview event is populated.
  6. Select on one of the Pageview event and you should see the image below Staging Snowplow Event
    • Note:
      • APP name is wogaa<websitename>staging
      • Collector address is snowplow.dcube.cloud

Note

Having the Test environment(s) setup successfully, allows our users such as the business owners and/or developers to test any existing or new enhancements that WOGAA pushes out or launches such as the Sentiments widget, widget designs and interactions, and etc, without worrying about it breaking their Live Environment(Production).


Implement and Verify Code in Production

Step 1. Insert Tracking Code

Insert the following code into the <head> of every page of your website, before other scripts.

<script src="https://assets.wogaa.sg/scripts/wogaa.js"></script>

Example

<html>
    <head>
        ...
        <script src="https://assets.wogaa.sg/scripts/wogaa.js"></script>
    </head>
    ...
</html>

Info

The base code does not support subresource integrity (SRI). Please do not enable SRI for base code.

Content Security Policies for Production

Info

This step is optional if your website doesn't have Content Security Policy enabled.

If your website has Content Security Policy enabled, update your CSP with the following code:

default-src 'self' https://*.wogaa.sg https://*.demdex.net/ https://cm.everesttech.net/ https://wogadobeanalytics.sc.omtrdc.net/;
frame-src 'self' https://wogaa.demdex.net;
script-src 'self' blob: https://*.wogaa.sg https://assets.adobedtm.com/;
img-src 'self' data: https://wogadobeanalytics.sc.omtrdc.net/ https://cm.everesttech.net/ https://dpm.demdex.net/;
connect-src 'self' https://*.wogaa.sg https://dpm.demdex.net/;
style-src 'self' 'unsafe-inline' https://assets.wogaa.sg/fonts/;
font-src 'self' data: https://assets.wogaa.sg/fonts/;

Step 2. Verify Production Environment

Once you have implemented the tracking code correctly, you will need the Chrome extension Snowplow Chrome Extension to verify the base code is working correctly.

  1. Install Snowplow Chrome Extension
  2. On Chrome, navigate to the website with the base code installed.
  3. Right-click on the page and click Inspect
  4. Inside the Inspect console, click on the Snowplow Tab, image of snowplow tab in console
  5. Refresh the page where the base code is installed, or navigate to a few tabs and see that Pageview event is populated.
  6. Select on one of the Pageview event and you should see the image below Production snowplow event
    • Note:
      • APP name is wogaa<websitename>prod
      • Collector address is snowplow-web.wogaa.sg

Step 3. Login to WOGAA and check your site's status

When you have added the WOGAA Tracking code to your site, it will usually take less than 24 hours for your site to be verified. The verification of your site will be done automatically, however to be considered as verified, our WOGAA backed server must be able to detect or capture any events sending over from your site - you can visit the page yourself to speed the process up.

Site - Pending Implementation and Verification is-pending-verification

Once WOGAA has detected any data/event that is sent from your site, the status of your registered site will be updated from "Pending Implementation and Verification" to the "Verified" state like the one shown below:

Site - Verified is-is-verified

As soon as it is verified, an email notification will be sent to the Officer-In-Charge (OIC) of the Informational Service as a confirmation.


After the WOGAA Tracking Code is Installed

You can start using any of WOGAA's features: Web Analytics, Uptime, Inspect, Sentiments, and more.

product-LP


Some Common Issues

If your verification is not working after you have installed the Tracking Code and waited for more than 24 hours, there are a few reasons this could be happening. Below are the common issues and how to resolve them.

  • The Tracking Code was added incorrectly

    It might be the case that you're using the staging tracking code in your production environment/site or vice versa, as such no data/event is detected in the correct collector in our WOGAA backend server.

    Solution: To find out if you've implemented the Tracking Code properly in the correct environment, refer to instructions for the different environments.

    Additionally, you can use your browser developer tools (e.g. Chrome DevTools) to troubleshoot, right-click the page and select Inspect to see if there is/are any errors in the developer console.

  • No traffic to your Site

    WOGAA verified tracking as being active if it detects at least one visit/event in the past hour. If your site hasn't had any visitors within the past hour(s),this could be due to low traffic to your site or perhaps your site's Content Security Policy(s) is blocking the WOGAA Tracking Code.

    Solution: If you suspect that the latter might be the issue, you need to whitelist your site's CSP rules. Refer to the different environments for the CSP configurations.


Still unable to get your Tracking Code to work?

No worries, WOGAA Support Team can help! You can reach out to us at wogaa@tech.gov.sg. We will response to you as soon as possible.