Skip to content

Commit

Permalink
exclude nested from include
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed Aug 7, 2023
1 parent 55b5895 commit 97b678e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion destinations/google-ga4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ Use the `string-dot` notation (`data.id`, `user.id`, `group`, `context.position.
Nested entities will be looped if available. Use `items` and the wildcard (\*) to access and add them dynamically (for `order complete` events with multiple nested `product` entities for example).

Use the `include` option to bulk-add event properties without explicitly mapping custom event parameters. This adds all available properties of the specified group. Available groups are `event` (for basic event properties like trigger, timing, etc.), `data`, `context`, `globals`, `nested`, `source`, `user`, `version`, or just `all`. All `data` properties are added automatically by default. If you don't want this add `include: []`.
Note: `consent` is not available via `include`, but you can add them explicitly. The properties get prefixed with the group's name and underscore (like `globals_lang` for `{ globals: { lang: 'de' } }`). Custom parameters will override `include` values with the same key.

> Note: `consent` and `nested` are not available via `include`, but you can add them explicitly using `params` or `items`.
The properties get prefixed with the group's name and underscore (like `globals_lang` for `{ globals: { lang: 'de' } }`). Custom parameters will override `include` values with the same key.

### Node usage

Expand Down
14 changes: 10 additions & 4 deletions destinations/google-ga4/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Elbwalker, { IElbwalker, Walker } from '@elbwalker/walker.js';
import Elbwalker, { IElbwalker } from '@elbwalker/walker.js';
import { DestinationGoogleGA4 } from './types';

describe('Destination Google GA4', () => {
Expand Down Expand Up @@ -252,9 +252,15 @@ describe('Destination Google GA4', () => {
}),
);

elbwalker.push('entity all', { foo: 'bar' }, trigger, {
position: ['reco', 0],
});
elbwalker.push(
'entity all',
{ foo: 'bar' },
trigger,
{
position: ['reco', 0],
},
[{ type: 'n', data: { k: 'v' }, nested: [], context: {} }],
);
expect(mockFn).toHaveBeenCalledWith(
'event',
'entity_all',
Expand Down
1 change: 0 additions & 1 deletion destinations/google-ga4/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const destinationGoogleGA4: DestinationGoogleGA4.Function = {
'data',
'event',
'globals',
'nested',
'source',
'user',
'version',
Expand Down
1 change: 0 additions & 1 deletion destinations/google-ga4/src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export declare namespace DestinationGoogleGA4 {
| 'data'
| 'event'
| 'globals'
| 'nested'
| 'source'
| 'user'
| 'version'
Expand Down

0 comments on commit 97b678e

Please sign in to comment.