googleAnalytics@v1

Measure offline (phone) interactions with Google Analytics.

VersiongoogleAnalytics@v1
Runs ininbound-call and your own branches · api-initiated and inbound-sms · hangup, postHangup and events.ready

Parameters

NameTypeRequiredDefaultDescription
idstringyes1..255 characters
secretstringyes1..255 characters
clientIDstringyes1..255 characters
eventsarray of objectyes1..25 items · accepts ${{ }}
events[].namestringyes1..255 characters
events[].paramsobject

Every parameter that accepts ${{ }} can be computed from an expression.

How it works

Measure offline (phone) interactions with Google Analytics https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference?client_type=gtag https://developers.google.com/analytics/devguides/collection/protocol/ga4/verify-implementation?client_type=gtag

In order for an event to be valid, it must have a client_id that has already been used to send an event from gtag.js. You will need to capture this ID client-side and include it in your call to the Measurement Protocol.

You also need a Measurement Protocol API Secret Admin > Data Streams > Your Stream > Measurement Protocol > Create

Here is the example from Google's documentation gtag('get', 'G-XXXXXXXX-Y', 'client_id', (clientID) => { sendOfflineEvent(clientID, "tutorial_begin") });

function sendOfflineEvent(clientID, eventName, eventData) { // Send necessary data to your server... }

Examples

Once you have a valid clientID on your server, you can use fetch@v3 to retrieve it. If you tied the clientID to a displayed number on your website, you can use the call.toNumber to retrieve it.

- action: fetch@v3
  params:
    url: "https://example.com/ga-client-id?number=\
      ${{ encodeURIComponent(call.toNumber) }}"
  result: $response

- action: googleAnalytics@v1
  params:
    id: G-XXXXXXXX-Y
    secret: measurementApiSecret
    clientID: ${{ $response.json.clientID }}
    events:
      - name: call
        params:
          # exemple params, send what is relevant to your use case
          fromNumber: ${{ call.fromNumber }}
          toNumber: ${{ call.toNumber }}
          scenarioName: ${{ scenario.name }}

Did this page help you?