Skip to content

Commit

Permalink
[STRATCONN] 3312 added event parameter in set Configuration fields (#…
Browse files Browse the repository at this point in the history
…1778)

* Removed default subscription and added params

* removed debug code

* updated the ga4-web version

* change in default value of presets in ga4-web

* test commit

* test commit

* Update ga4-properties.ts

* types changed

* resolved merge conflicts

* removed log
  • Loading branch information
AnkitSegment authored Jan 8, 2024
1 parent 80f3642 commit 6ec6bf1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@segment/analytics-browser-actions-google-analytics-4",
"version": "1.27.0",
"version": "1.27.2",
"license": "MIT",
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type ConsentParamsArg = 'granted' | 'denied' | undefined
const presets: DestinationDefinition['presets'] = [
{
name: `Set Configuration Fields`,
subscribe: 'type = "page" or type = "identify"',
subscribe: 'type = "page"',
partnerAction: 'setConfigurationFields',
mapping: defaultValues(setConfigurationFields.fields),
type: 'automatic'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'
import { user_id, user_properties } from '../ga4-properties'
import { updateUser } from '../ga4-functions'

import { user_id, user_properties, params } from '../ga4-properties'
type ConsentParamsArg = 'granted' | 'denied' | undefined

// Change from unknown to the partner SDK types
const action: BrowserActionDefinition<Settings, Function, Payload> = {
title: 'Set Configuration Fields',
description: 'Set custom values for the GA4 configuration fields.',
platform: 'web',
defaultSubscription: 'type = "identify" or type = "page"',
defaultSubscription: 'type = "page"',
lifecycleHook: 'before',
fields: {
user_id: user_id,
Expand Down Expand Up @@ -93,10 +91,10 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
description: `The resolution of the screen. Format should be two positive integers separated by an x (i.e. 800x600). If not set, calculated from the user's window.screen value.`,
label: 'Screen Resolution',
type: 'string'
}
},
params: params
},
perform: (gtag, { payload, settings }) => {
updateUser(payload.user_id, payload.user_properties, gtag)
if (settings.enableConsentMode) {
window.gtag('consent', 'update', {
ad_storage: payload.ads_storage_consent_state as ConsentParamsArg,
Expand All @@ -113,7 +111,8 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
cookie_expires: settings.cookieExpirationInSeconds,
cookie_path: settings.cookiePath,
allow_ad_personalization_signals: settings.allowAdPersonalizationSignals,
allow_google_signals: settings.allowGoogleSignals
allow_google_signals: settings.allowGoogleSignals,
...payload.params
}

if (payload.screen_resolution) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export interface Payload {
* The response type of the request. Currently only supporting JSON.
*/
responseType: string
/**
* Whether the message should be retried (if the error code is retryable) when the data feed fails or if it should be sent with empty data instead
*/
shouldRetryOnRetryableError?: boolean
/**
* A user profile's traits
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ export interface Payload {
* The response type of the request. Currently only supporting JSON.
*/
responseType: string
/**
* Whether the message should be retried (if the error code is retryable) when the data feed fails or if it should be sent with empty data instead
*/
shouldRetryOnRetryableError?: boolean
}[]
/**
* An array of user profile identity information.
Expand Down

0 comments on commit 6ec6bf1

Please sign in to comment.