## 2 Background
### Mapping Phase  
In the mapping phase, functional processes, objects of interest, and data groups are identified to extract and measure the elements that contribute to functional size using the COSMIC method. **(1) Identification of functional processes**  
In the Data Collection Layer of Google Tag Manager (GTM), the functional processes are triggered by events that occur due to user interactions on the website or app. These events were then captured and passed through the system. _Functional Process 1: JavaScript Snippet Capturing a User Interaction Event_  
A user's action on a website or app, such as page view, button click, or form submission, acts as a triggering event. When a user clicks the \"Submit\" button on a form, the event is captured by the dataLayer and includes the button ID, form-field values, and timestamp. Event data (e.g., page URL, button ID, or form data) are captured by the dataLayer and moved into the system through COSMIC Entry data movement. This data group contains information about user interaction, such as which page was viewed, which button was clicked, or what form was submitted. In the Data Processing Layer in Google Tag Manager (GTM), the functional processes are responsible for evaluating, processing, and acting on the data collected by the Data Collection Layer. This layer deals with deciding when to fire tags, processing dynamic variables, and sending data to analytic systems. _Functional Process 2: Trigger Evaluation_  
Data from the Data Collection Layer (e.g., page view or button click) are passed to GTM for trigger evaluation. GTM reads the conditions set in the Triggers (e.g., \"If a button is clicked\" or \"If the user scrolls 50% of the page\") and stores the result of the evaluation temporarily (e.g., whether a tag should fire). These conditions were evaluated based on the data received from the Data Collection Layer. _Functional Process 3: Variable Processing_  
When a tag or trigger requires dynamic data (e.g., button ID, product name, or user action details), GTM retrieves this information from the variables stored in the system. GTM reads dynamic data from the variables or dataLayer (e.g., button name or page URL). The retrieved data are used to populate the tag or trigger conditions and store the dynamic data before the final action (firing the tag). _Functional Process 4: Tag Firing_  
After evaluating the trigger conditions and processing the necessary dynamic data, GTM decides whether to fire a tag. A triggering event is the result of a trigger evaluation  
Figure 5: COSMIC Software Context Model for Google Tag Manager. process. GTM reads the outcome of the trigger evaluation and any dynamic data required from the variables. The tag is fired, and the data are sent to an external analytics platform (e.g., Google Analytics or Facebook Pixels). This constitutes an Exit in COSMIC terminology, as the data leave the GTM system and are transmitted to an external functional user. _Reused Components:_ reused GTM components (e.g., variables) can be used in more than one tag or trigger. Based on the COSMIC rules, the measurement is applied to Functional User Requirements and their associated data movements, not on components per say. Therefore, a single GTM component can appear in many functional requirements and contribute to many data movements. _Layered logic:_ GTM may include layered logic, such as a tag that may not fire until a certain user activity is met. For example, a tag will fire only if the user scrolls to 50% of the page for logged in users. COSMIC guidelines treat this as separate data movements under each functional process (one data movement for scrolling and one data movement of the login condition in this example). The focus here should be on functional processes and requirements rather than on the structure of the technical implementation in GTM, as the layered logic does not determine the number of functional processes or data movements; rather, it is the actual count of data movements--regardless of logic complexity--that defines the functional size.