@compilacion/colleciones-clientos 2.0.7 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -100,19 +100,64 @@ collecionesDsl
100
100
 
101
101
  ### 4. Manually Create Events (Optional)
102
102
 
103
- You can also build structured events directly via the event class:
103
+ You can also build structured events directly via the event class. Below are examples for all main options supported by the DSL:
104
104
 
105
105
  ```js
106
106
  import { CollecionesEvent } from './index.js';
107
107
 
108
108
  const event = new CollecionesEvent();
109
- event.setEntity('form');
110
- event.setAction('submitted');
111
- event.setIdentifier('formId', 'abc123');
112
-
109
+ // Entity and Adjectives
110
+ event.setEntity('button');
111
+ event.addAdjective('dark');
112
+ event.addAdjective('green');
113
+
114
+ // Entity Identifiers
115
+ event.setIdentifier('id', 'button12');
116
+ event.setIdentifier('externalReference', 'ext-123');
117
+
118
+ // Action
119
+ event.setAction('clicked');
120
+
121
+ // Actor and Actor Identifiers
122
+ event.setActor('user');
123
+ event.setActorIdentifier('usrId', 'abc-123');
124
+ event.setActorIdentifier('email', 'jef@email.com');
125
+
126
+ // Context
127
+ event.setContext('sourcePage', 'homepage');
128
+ event.setContext('ctaLabel', 'register-now');
129
+
130
+ // Collections
131
+ // Property collection
132
+ // Add first property item
133
+ const propertyKey1 = event.setCollectionItem('property');
134
+ event.setCollectionItemReference('property', propertyKey1, 'propertyId', '1');
135
+ event.setCollectionItemReference('property', propertyKey1, 'externalId', '12');
136
+ // Add second property item
137
+ const propertyKey2 = event.setCollectionItem('property');
138
+ event.setCollectionItemReference('property', propertyKey2, 'propertyId', '2');
139
+ event.setCollectionItemReference('property', propertyKey2, 'externalId', '13');
140
+ // Suggest collection
141
+ const suggestKey1 = event.setCollectionItem('suggest');
142
+ event.setCollectionItemReference('suggest', suggestKey1, 'suggestionId', '1');
143
+ const suggestKey2 = event.setCollectionItem('suggest');
144
+ event.setCollectionItemReference('suggest', suggestKey2, 'suggestionId', '2');
145
+
146
+ // References
147
+ // Reference to property entity
148
+ event.setRefence('property');
149
+ event.setRefenceIdentifier('property', 'id', '123');
150
+
151
+ // Schema
152
+ event.setSchema('UserInteractionEvent');
153
+
154
+ // Send the event
113
155
  tracker.track(event);
114
156
  ```
115
157
 
158
+ This example covers all main options: entity, adjectives, identifiers, action, actor, actor identifiers, context, collections, references, and schema.
159
+ ```
160
+
116
161
  ---
117
162
 
118
163
  ## Learn More
@@ -121,4 +166,10 @@ tracker.track(event);
121
166
  - 🏗️ [Architecture](./docs/architecture.md)
122
167
  - 🔄 [Emitters & Trackers](./docs/emitterAndTracker.md)
123
168
  - ✍️ [DSL Syntax](./docs/dsl.md)
124
- - 📦 [Event Structure](./docs/events.md)
169
+ - 📦 [Event Structure](./docs/events.md)
170
+
171
+ ## one more thing
172
+ It is also available in gtm
173
+ This is a real real pain
174
+ All things gtm can be found here:
175
+ 🤕 [Gtm](./docs/gtm/readme.md)