Configuring Analytics

Prerequisites#

Note: If you have never used Google Analytics before, take a quick look at the beginner series of tutorials.

Make sure you have access to the iQmetrix Google Analytics account. Send email to ITSupport@iqmetrix.com to request access.

Creating a Property for Your App#

  1. Login to Google Analytics and navigate to Admin using the sidebar.

    Google Analytics Admin

  2. If the Hub app that you want to manage does not already have a Google Analytics account associated with it, you will need to create one:

    1. Select Create Property.

    2. Enter your app name in Website Name.

    3. Fill out the other fields as necessary.

    Create New Property

  3. Grant permissions to the app team.

    1. Go to Property dropdown, and select your app.

    2. In the Property panel, select User Management.

    3. Scroll down to Add permissions for and add the emails of your app team and choose their level of access.

    4. The developers you added should get an email to their Google accounts with information on how to access this Google Analytics account.

    Add Permisions

Adding User-ID tracking to Your v1 App#

More information on User-ID tracking

  1. In app.js, use the tracker’s enableUserIdTracking() method.

    Make sure to send the proper User Context. If you are impersonating another company, consider which id you want to send, iQ or the impersonated company.

  2. In Google Analytics, turn on User-ID tracking.

    1. Navigate to Admin > Tracking Info > User-ID

    2. Follow the instructions to enable User-ID tracking.

      Enable User-ID feature

    3. Create a new view.

      Eg. General View.

      Adding user tracking is similar to adding a filter to the data, the data will be different than that of views without user tracking.

Creating Views#

Filtering Environments#

In Google Analytics, you can create filters to see data from specific environments, such as Integration (hubint) or Production (hub). This is done through creating views.

  1. Select the Propriety you want to modify

  2. Create a new view and choose a name to identify the filter.

    Eg. Commission - Production or Commission - Integration

    Filter Environments

  3. Select Filters > Add Filter.

  4. Select Apply existing Filter

  5. Select the filter to apply.

    Eg. Hub Production Filter

    Apply Hub Production Filter

  6. Save

  7. After saving, you can view the details of the filter.

Filtering Internal IPs#

You can filter analytics between internal and external users.

  1. Follow the previous steps to create a new view filtered.

    Eg. Commission - Production w/o IQ IPs.

  2. Add the Hub Production filter created above.

  3. Add IP Filters for the iQmetrix Offices. You will need to add 2 filters for each office.

    • Exclude internal traffic
    • Exclude Regina 1
    • Exclude Regina 2
    • Exclude Winnipeg 1
    • Exclude Winnipeg 2
    • Exclude Vancouver 1
    • Exclude Vancouver 2
    • Exclude Charlotte 1
    • Exclude Charlotte 2

    Exclude IPs

Adding Google Analytics to Your App#

React#

For React apps, follow the instructions from the @iqmetrix/analytics

When using the @iqmetrix/cra-template, Google Analytics is configured using the default Tracking ID.

Hub V1#

  1. Login to Google Analytics and navigate to Admin using the sidebar.

  2. Navigate to your app using the Property dropdown.

  3. Select Property Settings > Get Tracking ID and copy your Tracking ID.

  4. Add the tracking script to your app.es6.js.

  5. Add the HubCommon tracker util with the Tracking ID to app.es6.js.

    import { tracker } from "hub/utils/ga";
    import UserContext from "hub/utils/userContextModel";
    // ...
    const setDefaultAppSettings = () => {
    tracker.initialize("UA-XXXXXXXX"); // Your GA code
    tracker.enableUserIdTracking(UserContext); // User-ID tracking
    tracker.addPageTracking(App);
    // ...
    };
  6. Any files where you would like to track an event, you will need to import the tracker, and use the tracker’s sendEvent method. More details

    this.tracker.sendEvent({
    category: "Codes",
    action: "created",
    label: model.get("Name"),
    value: model.get("Quantity"),
    });
Last updated on by Paulo Andrade