# Google Analytics

* [Which version of the analytics to use](#which-version-of-the-analytics-to-use)&#x20;
* [How to create and set a property on a mini-landing ](#how-to-create-and-set-a-property-on-a-mini-landing)
* [How to share Google Client ID(\_ga) from the mini-landing with variables](#how-to-share-google-client-id-_ga-from-the-mini-landing-with-variables)&#x20;
* [How to transfer GA data from Salebot](#how-to-transfer-ga-data-from-salebot)&#x20;
* [How to configure event goals ](#how-to-configure-event-goals)
* [How to transfer events ](#how-to-transfer-events)
* [How to use requests of the Page View type (t:pageview)](#how-to-use-requests-of-the-page-view-type-t-pageview)&#x20;
* [How to use E-commerce](#how-to-use-e-commerce)&#x20;
* [Video tutorial](#video-tutorial)

## Which version of the analytics to use

{% hint style="warning" %}
Integration with Google Analytics only works for the Universal Analytics version.
{% endhint %}

New properties are created in the GA4 version by default. Our requests will be ignored.

You need to create analytics with the switch turned on (as shown in the screenshot below)

![](https://lh6.googleusercontent.com/Op7DykeJFlC4pQfxEonkY3UVIwm6ovCB80C-p6TJCsgEv-tw4UNIkyxySmZwUOa6jFDrItQb5ZdQx47-sXFwDEmSYK6-dSVhRh0rBnuYN7PXIB-_QUYqwwPVOofMrR9Zg-WzLPnWMIV1qNCa5A)

![](https://lh6.googleusercontent.com/sNoqcFTjekH2SnOsfUr1l_gXOYexOAcyLt7vq1xEJ5JKVD28z_iArTJpk8Mw_OujMRdS3OvvNwzq8tRzwUS1DWz-jRfhHZ4wSErG6g1O8VBe0XQuyDB4vg6lrqLc_kTDtSyDogGoX29SxVh5xw)

## How to create and set a property on a mini-landing

Create a property on <https://analytics.google.com/>

Move into Tracking info -> Tracking code

![](https://lh3.googleusercontent.com/mYXiIfwXUgjnZg3HjFsk8UzOnwoWgs-9qgMTZJJv3Fky4miW3flXYSBW83n6fjR-3uZZpaYlgjXDis8CO8TDrpxGtjyQLVe4iARbYJRf88qF5qF-VcIn_AJc8ND4p6f2G7V3dhaGCW708CUQqg)

Copy the code and paste it into the head of the mini-landing

![](https://lh6.googleusercontent.com/BNpAF4ovJ-fB0bsidS7hbuZ1GmlyLotWlPIltMGiTXjF-nSkQE0LgRHgcZLc2wez8yZb6nyoKaRApAd1mLOXEMJhJzaudNnVUjNCRRhfT7-E_-teFsd9gCySEYNvFcjuxFl18gNVCvBUsl37Wg)

![](https://lh4.googleusercontent.com/P0rvT-N9D4km0VVgQqDGQyk4mPHcPZ4JY6t_9lYAskp-Bw5i8oKpu4wIRGCEkxuHkuwUB1XkjFwaxzjTBkAJLU6AzV1R9hc1SjRMIyPyyRYzA1ADC2hQlrKHZoGA-4iGEq8e2LOpbSlBJRkkiA)

To facilitate further work, it’s recommended to add properties to mini-landings using Google Tag Manager, but it’s not mandatory.

Next you need to find Tracking id in the Property settings

![](https://lh3.googleusercontent.com/ktAxc04sJjD2SDzn5BpOefD55vlF1FNjm89_pnVowPzDriQnDsSM5vHEk3Yo7yEvMCeuiSdLuqLKuJIbvKqIHWjCqDcDuYCbZ-ClPCRewJW4CV5-SX8WRMaTYHaqGaGgqtGB1NoSVyFiIh34lw)

Copy the Tracking id, then open the project’s settings on Salebot and save the id in the Project Constants under the name of **google\_tracking\_id**:

![](https://lh3.googleusercontent.com/Ybz6q-G3jFKq4gbFnBVuHkXJwhgzFUR3lObBP8k0ieZ0dQbowAmmj2Z2PgZttJlx8QF1byct4zrin8kO1U7gh1uk4V2hiAAfAcBSgn3M3e9rosj2uVTBQzfb9eJ_jQ5_ACgPbd8KnbKOG7o11g)

## How to share Google Client ID(\_ga) from the mini-landing with variables

To share the client id, you need to tick off Google Client ID(\_ga) in the mini-landing’s settings. After the bot’s launch the variable **\_ga** will appear.

![](https://lh5.googleusercontent.com/IZ9wQ5-EAigL_jwMn3FPQ48_ad2teURPG9Kjylr8pLkYmafreiKc4iY6KlmjdeZ9xztiNteyogcN-w8PmtJxYKfT1lA_ytUJXkhv_I7va3NHNEgSJrbRvPdWI4VcmvUqrTbKdVZiQXZLFsMYfw)

## How to transfer GA data from Salebot

During the function call for transferring data to Google Analytics, some parameters are being shared **automatically**, the info below is shown to get the general idea on how the function works.

For functions **ga\_pageview** and **ga\_transaction\_pageview** the parameter “t”: “pageview” is transferred

For functions **ga\_event** and **ga\_transaction\_event** the parameter “t”: “event” is transferred

For functions **ga\_transaction\_pageview** and **ga\_transaction\_event** the parameter “pa” with the value “purchase” is transferred additionally.

Also, when calling all functions, the parameter **cid** is transferred automatically - it’s the client id for analytics. If the user came into the bot from the mini-landing, as shown above, then the id gets automatically saved into the project variables, into the variable **\_ga**

![](https://lh5.googleusercontent.com/ckT9oGxRsFH-BmaOGxlYiZ0iKKUnlxMx_qglqF2F-x0U2x1xJZXVKiothDGanpu9bB3BQOgm_Ubc0VMoM2fw-A30SK_eKebRaCZ7AkLm7pQKMYKBWTm7xW7IbM3sO4jtatcvG1cSY4UH2k6GPw)

If the client card doesn't have this variable, then it’s generated automatically as a random line of numbers, but in that case it’s recommended to transfer the traffic source in the advanced settings (shown below - How to redefine the source)

## How to redefine the source

If you need to set the traffic source for your event manually, then you can add any request type to it with the following parameters. The dictionary below isn’t independent - it’s used only when calling the functions mentioned in the Advanced parameters field.

`'{ "cs":"#{utm_source}", "cm":"#{utm_medium}", "cn":"#{utm_campaign}", "ck":"#{utm_term}", "cc":"#{utm_content}"}'`

Documentation on the parameters:

{% embed url="<https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#trafficsources>" %}

## How to use requests of the Events type (t:events)

They are used in Google Analytics for certain events. You can configure the goals in GA, they are fixed when certain events happen (i.e. not all shared events have to be a goal necessarily).

You can find the events in the section Behaviour -> Events -> Top Events

![](https://lh4.googleusercontent.com/Fqs4mjmTrDlvO-mNQlH9xRC3qjYM42DnnyRjRkMxPDTISx9_fYimuq-XdJqSLqaoLfuFfK7k1ItNwVG5xxIlljh_iufFPb3wiE0r2m57OI36Jx6ECwj-kWFzqy9MVEQa_5Up_YnSerTkeJbUAQ)

## How to configure event goals

You can configure goals for important workflow steps and use them for tracking conversions in between steps. Goals are set up in the section Conversions -> Goals

![](https://lh5.googleusercontent.com/jgwnuIXv9cuUnYXOtztAPuS9wm3_hrN-todKsF3-yevJKEv2256sO_gfwVeSTakXm863eh86dF0DtN3-HSq_qkB33BcMbd-JJVUXP8kSV7oOgMRyR9vFpRppac75r9EdTe3qE5aXgqDOjLxrwA)

![](https://lh6.googleusercontent.com/bWiI3wGWMm2fa5SBnSNJnwKIB-tOqLMLHNYk8kLDny5Rmm2BRCoCVXl0P2JDlCtnTyq3pZr5Fq5ryfdOKBacbqLPnQn-hlkq9MhKi65MR3_CMnyza2wHK1fGA_1g8jWZ7TSQDZ0Y2Q_hv3sETA)

## How to transfer events

To transfer an event in GA, you need to, when moving to a different stage, call the function **ga\_event()** with needed parameters in the calculator field.

**ga\_event (‘category’, ‘event action’**, ‘label’, ‘event value’, ‘{“parameter name”: “value”, “parameter name 2”: “value 2”}’)

#### Clarification on the parameters from the example above:

**category** - event category (mandatory parameter) \
**event action** - mandatory parameter \
**label** - event label event value gets transferred as integers and gets written down as the currency that’s set in the acquisition settings \
**the dictionary with additional parameters**; example: '{"ti":"#{order\_id}", "tr":"25", "tcc":"#{promocode}"}'

#### Example of the function call:

ga\_event('sale', 'list viewing’) \
ga\_event('Salebot', 'Enter bot', '#{tag}', '100', '{"ti":"#{order\_id}", "tr":"#{price}", "tcc":"#{promocode}"}') \
ga\_event('Salebot', 'Enter bot', '#{tag}', '100') \
ga\_event('Salebot', 'Enter bot', "", '20')

## How to use requests of the Page View type (t:pageview)

By transferring data on page viewership, you imitate a visit by the webpage user. To see a standard report of the pages, go to Behaviour -> Site Content

![](https://lh5.googleusercontent.com/HEHn4m4mwUEgViVeUJ-eTRMu60FL2uvcAfqEoGSIjZmCsAyaQxr_L-9TlfyhfW9UaAh6TEFuhEUPQ_iPIC1DJ2E1sSkZv9vbVDJ_zxxckYZuvy3nDoJDScWxOwnBSPZCEbEVjrbd8tFajKW-eA)

If you configure a goal for visiting pages, you can get a virtual workflow of following the bot’s branch without exiting Google Analytics.

![](https://lh5.googleusercontent.com/CxeTY_FRy3uY4SxmZhteQG6yqbDgD9mswRXmDqMA5lUwwET_flZvSXLxdgBflNCc7Jlq8hhmqjMge5grqDw4g16iHfyRHjbRBLHwLZck45CHxU6KMDZ97q2ZJJyKNHlxDVh7SLF7YIkDl0-fhw)

An example of the configuration:

![](https://lh4.googleusercontent.com/L81lDP7gdVcb9hEqdCoGcm4DJ7PAmrY2LQK1VguoI7rwdLBQYWD3VXXbVe1Namb-t-TSZPI_z0QSknXsuFfu-_K34ojnj7tQgmeBluWclBPE0S1z-2pN9mRXrbBX4VYRWbZsRNP9zRL6snBA-A)

The **advantage** of this method is the visual representation of the workflow motion without having to leave Analytics.

The **disadvantage**, though, is the fact that you are essentially only transferring one parameter - the visit to a block. Additional data such as Label or Value, like in the Event requests, can’t be transferred like this.

To transfer data on viewing the page in GA when moving to a block, it’s essential to call the function **ga\_pageview(**) with needed parameters in the calculator field.

**ga\_pageview(‘URL page path’, ‘title’**, ‘{“parameter name”: “value”, “parameter name 2”: “value 3”}’)

#### Clarification on the parameters from the example above:

**URL page path** - the part of the URL that holds its path \
**title** - the title of the page/document \
**a dictionary with additional parameters** of this structure: ‘{“parameter name”: “value”, “parameter name 2”: “value 2”}’

#### Example of the function call:

ga\_pageview('/start, 'Entry point') \
ga\_pageview('/pay', ‘Sale’, '{"cd1": "High Scores"}')

For the transfer of additional parameters, refer to the documentation linked below. There you can find all possible parameters with detailed descriptions:

{% embed url="<https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#content>" %}

## How to use E-commerce

The E-commerce set up in the All Web Site Data tab

![](https://lh3.googleusercontent.com/0Fx6Qq2BMLYClrpGe03igYTkpJnx9bLjwVSX0oeDRgQAasheRsYrpo31oXa5HaMTscnpxloIJZvrtA_ajMVMigNAor9ukwVVguvxGd_A6iNO8uhTViBenW2xbZfRLFZVYl2x2YY4l1eC-LbcSQ)

{% hint style="warning" %}
The E-commerce parameters need to be sent as the existing requests (pageview, event)
{% endhint %}

There are two functions for this purpose: **ga\_transaction\_pageview** and **ga\_transaction\_event**. More on them below.

### The function ga\_transaction\_pageview

Mandatory parameters are in bold:

**ga\_transaction\_pageview('transaction id', 'total income’, 'URL page path', ‘title’**, 'list of products’, 'dictionary of additional parameters’)

#### Clarification on the parameters from the example above:

**transaction id** - the transaction’s unique id \
**total income** - the total income tied to the transaction \
**URL page path** - the part of the URL that holds its path \
**title** - the title of the page/document \
**list of products** - the array of products of this structure: '\[\["id", "name", "price", "amount"], \["id", "name", "price", "amount"]]' \
**a dictionary with additional parameters** of this structure: ‘{“parameter name”: “value”, “parameter name 2”: “value 2”}’

#### Example of the function call:

ga\_transaction\_pageview('#{order\_id}', '2200', '/send', ‘Received’, '\[\["222", "Rate1", "1200", "1"], \["223", "AdditionalRate", "1000", "1"]]')\
\
ga\_transaction\_pageview('123', '100', '/pay', 'Payed', '', '{"cd": "High Scores", "cs":"#{utm\_source}", "cm":"#{utm\_medium}", "cn":"#{utm\_campaign}"}' )

The array of products is as follows: **array of arrays**:

'\[\["product\_id", "product name", "product price", "amount of products"], \["product\_id", "product name", "product price", "amount of products"]]'

Each product must have 4 parameters, the whole array in single quotes (‘), the parameters inside - in double quotes (“)

### The function ga\_transaction\_event

Mandatory parameters are in bold:

**ga\_transaction\_event('transaction id', 'transaction income’, 'event category', ‘event action’, 'event tag'**, 'event importance', 'list of products’, 'additional parameters’)

#### Clarification on the parameters from the example above:

**transaction id** - the transaction’s unique id \
**total income** - the total income tied to the transaction \
**event category, event action, event tag** - mandatory parameters\
**event importance** - transferred in whole numbers and gets written down in the same currency as it is set in the viewing settings\
**list of products** - the array of products of this structure: '\[\["id", "name", "price", "amount"], \["id", "name", "price", "amount"]]' \
**a dictionary with additional parameters** of this structure: ‘{“parameter name”: “value”, “parameter name 2”: “value 2”}’

#### Example of the function call:

ga\_transaction\_event('1244', '121.2', 'category1',  'action', 'tag', '10', '\[\["11", "Product1", "1.2", "1"], \["22", "Product2", "120", "1"]]')

ga\_transaction\_event('1244', '1.2', 'category1',  'action', '', '', '\[\["11", "Product1", "1.20", "1"]]')

ga\_transaction\_event('1244', '121.2', 'category1',  'action', 'tag', '10', '\[\["11", "Product1", "1.2", "1"], \["22", "Product2", "120", "1"]]', '{"ta": "Google Store", "cs":"#{utm\_source}", "cm":"#{utm\_medium}", "cn":"#{utm\_campaign}"}' )

The array of products is as follows: **array of arrays**:

'\[\["product\_id", "product name", "product price", "amount of products"], \["product\_id", "product name", "product price", "amount of products"]]'

Each product must have 4 parameters, the whole array in single quotes (‘), the parameters inside - in double quotes (“)

###

## Video tutorial


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/integrations/other/analytics/google.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
