A segment is a subset of your Analytics data. For example, of your entire set of users, one segment might be users from a particular country or city.

You can have predefined segments created by Google or custom segments created by you. You can segment your data when querying Google Analytics. This is useful to prevent Google from sampling your data or return data associated with specific segments.

To request data associated from a segment:

  1. Open the Google Analytics Query Explorer.
  2. In the segment field, enter the name of your segment. As you begin to type, all the relevant segments are displayed. Below the segment name is Google Analytics ID.
  3. Copy the Google Analytics ID (gaid::X).
  4. Open the Google Analytics tables.xml file saved in %ProgramData%\Sisense\PrismServer\LocalRepository2.0\Resources\Google\Analytics
  5. In the XML file, paste the following code under the relevant table to be segmented. For Example:
    <table name="Traffic, Daily Report" accumulate_by="ga:date">

     <segment>

         <![CDATA[gaid::-4]]>

      </segment>

       <fields>

         <field id="Site"></field>

         <field id="ga:date"></field>

         <field id="ga:bounces"></field>

         <field id="ga:entrances"></field>

         <field id="ga:exits"></field>

         <field id="ga:newUsers"></field>

        <field id="ga:sessionDuration"></field>

         <field id="ga:users"></field>

         <field id="ga:sessions"></field>

       </fields>

     </table>

  6. Save your changes to the XML file. The next time you return data, the segmented data is returned.

Filtering Google Analytics Data

Sisense allows you to filter your data returned from Google Analytics according to View-level filters. For example, you can use filters to exclude traffic from particular IP addresses, include only data from specific subdomains.

By using a filter in Sisense you increase the number of dimensions you can import to a table as a workaround to Google Analytics 7 dimension limitation for any query.

Filtering your incoming hits permanently includes, excludes, or alters those hits in that view, according to the type of filter. Therefore, you should ALWAYS maintain an unfiltered view of your data so you always have access to your full data set.

To apply filters to your query:

  1. Open the Google Analytics tables.xml file saved in %ProgramData%\Sisense\PrismServer\LocalRepository2.0\Resources\Google\Analytics
  2. In the XML file, paste the following code under the relevant table to be filtered.  For Example:
    <table name="Traffic, Daily Report" accumulate_by="ga:date">

     <filter>

         <![CDATA[ga:userType!=New Visitor]]>

      </filter>

       <fields>

         <field id="Site"></field>

         <field id="ga:date"></field>

         <field id="ga:bounces"></field>

         <field id="ga:entrances"></field>

         <field id="ga:exits"></field>

         <field id="ga:newUsers"></field>

        <field id="ga:sessionDuration"></field>

         <field id="ga:users"></field>

         <field id="ga:sessions"></field>

       </fields>

     </table>

  3. Save your changes to the XML file. The next time you return data, the filtered data is returned.

Sorting Google Analytics Data

You can define the sort order and the direction of data returned from Google Analytics according to A list of metrics and dimensions indicating the sorting order and sorting direction for the returned data.

  • Sorting order is specified by the left to right order of the metrics and dimensions listed.
  • Sorting direction defaults to ascending and can be changed to descending by using a minus sign (-) prefix on the requested field.

For example, “What are my top countries, and which browsers do they use most?”

    <sort>

        ga:country,ga:browser

     </sort>

This example sorts the data by country and browser in ascending order. To return the data in descending order, add the prefix “-” as shown below:

    <sort>

       -ga:country,-ga:browser

     </sort>

To sort your Google Analytics data:

  1. Open the Google Analytics tables.xml file saved in %ProgramData%\Sisense\PrismServer\LocalRepository2.0\Resources\Google\Analytics
  2. In the XML file, paste the following code under the relevant table to be sorted. For Example:
    <table name="Traffic, Daily Report" accumulate_by="ga:date">

         <sort>

            -ga:sessions,-ga:date

         </sort>

       <fields>

         <field id="Site"></field>

         <field id="ga:date"></field>

         <field id="ga:entrances"></field>

         <field id="ga:exits"></field>

         <field id="ga:newUsers"></field>

         <field id="ga:pageviews"></field>

         <field id="ga:users"></field>

         <field id="ga:sessions"></field>

       </fields>

     </table>

  3. Save your changes to the XML file. The next time you return data, the sorted data is returned.