Skip to content

Commit e379cf7

Browse files
committed
Add hide tracking migration guide
1 parent 246295a commit e379cf7

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

docs/pages/_meta.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"migration-guide": {
2727
"display": "hidden"
2828
},
29+
"tracking-migration-guide": {
30+
"display": "hidden"
31+
},
2932
"tutorial": {
3033
"title": "Tutorial",
3134
"type": "page",
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
---
3+
4+
import {
5+
Callout,
6+
Tab,
7+
Tabs,
8+
Steps,
9+
Cards,
10+
Card,
11+
FileTree,
12+
} from "nextra-theme-docs";
13+
14+
# Tracking Migration Guide
15+
16+
![Tracking Migration Guide Cover](@/assets/images/migration-guide/cover.jpg)
17+
18+
## Get Started
19+
20+
This is a simple guide to migrate the way you use tracking in existing modules of the **Developer Hub Ecosystem**.
21+
22+
### Existing processes/disadvantages
23+
24+
Currently modules use the _Tracking Package_, but this mechanism in the context of the **Developer Hub Ecosystem** modules brings a series of disadvantages listed below and we want to simplify this process.
25+
26+
- The _Tracking Package_ is a library that must be imported and used directly by the module, which increases the size of the bundle, when in many cases the module does not need to activate tracking.
27+
- The _Tracking Package_ currently has in its code, and by design, configurations of the available tenants and each time a tenant is added an update of the library is needed.
28+
- The _Tracking Package_ currently uses microservices endpoints and has saved an `API Key` within the code for this. If this `API Key` expires, all modules would have to be massively updated, causing new deployments.
29+
- The _Tracking Package_ currently follows frequent update cycles which would cause unnecessary module deployments.
30+
- Currently the responsibility of installing/importing/updating the _Tracking Library_ is assumed by the partners and it should not be that way.
31+
- Currently it is a bit complicated to do QA when using _Tracking Package_ by modules.
32+
33+
For these reasons we have been looking for alternative solutions that reduce all these problems and also simplify the ease of QA reviews.
34+
35+
### Alternative proposal
36+
37+
Since all modules, regardless of the technology in which their code is developed (say React, Angular, Vue...), must import **Registry Script** by obligation, we have developed a solution in which the call to the tracking events is the responsibility of that **Registry Script** library.
38+
39+
For this purpose, a new function `trackEvent` has been created, whose implementation is basically an empty code that receives the `eventObject` that have been defined when using the _Tracking Package_. It would no longer be necessary to import or install the _Tracking Package_, just use this new function defined in **Registry Script**.
40+
41+
This new function would be practically empty code by definition. Its job is to redirect calls to the _Tracking Package_, and this would only work when the tracking resources are dynamically inserted into the Iframe and for a tenant/module combination. This dynamic insertion would be done by the platform and would be outside the partner context. We repeat: it will no longer be necessary to import/install the _Tracking Package_.
42+
43+
Advantages:
44+
45+
- The module's bundle size is reduced, it no longer needs the Tracking Package.
46+
- The partner does not need to take responsibility for installing/importing/updating the Tracking Package.
47+
- Tracking resources will be dynamically inserted by the platform in situations where they are needed.
48+
- The need for frequent updates to modules and deployments related to updates to the Tracking Package is no longer necessary.
49+
- Improved ability to do QA reviews to the tracking system: Now visible in the Playground
50+
51+
A detailed explanation with examples and the steps required to perform the migration will be explored in the next section.
52+
53+
<Callout>
54+
In this guide, **Developer Hub** and **Registry** are used to refer to the same concept.
55+
</Callout>
56+
57+
## Concepts/Some examples
58+
59+
Industries
60+
61+
- Airlines: `flights`
62+
- Hospitality: `hospitality`
63+
- Events: `events`
64+
65+
66+
Current invocation of tracking by the Registry modules
67+
68+
```js
69+
import formatter from '@everymundo/airmodules-event-datalayer';
70+
71+
// For Vertical Airlines
72+
formatter.formatAirlines(eventObject);
73+
74+
// For Vertical Hospitality
75+
formatter.formatHotels(eventObject);
76+
77+
// For Vertical Events
78+
formatter.formatEvents(eventObject);
79+
```
80+
81+
New tracking invocation by Registry modules
82+
83+
```js
84+
import { trackEvent } from '@everymundo/registry-script'
85+
86+
// For Vertical Airlines
87+
trackEvent('flights', eventObject);
88+
89+
// For Vertical Hospitality
90+
trackEvent('hospitality', eventObject);
91+
92+
// For Vertical Events
93+
trackEvent('events', eventObject);
94+
```
95+
96+
<Callout>
97+
The `eventObject` remains the same as before
98+
</Callout>
99+
100+
## Migration step by step
101+
102+
<Steps>
103+
104+
### Update **Registry Script** to `v0.6.0` or higher
105+
106+
107+
### Remove Tracking Package
108+
109+
110+
### Update the function call to fire the tracking event
111+
112+
113+
</Steps>
114+

0 commit comments

Comments
 (0)