UNPKG

6.69 kBMarkdownView Raw
1RED Measurement Framework
2=======
3
4## Outline
5
6The RED Measurement Framework (RMF) is a collection of javascript code that is to be implemented in a browser based measurement system for tracking of events on websites in the aim of segmenting users based on their behavior.
7
8It's intentionally meant to integrate and work with the following:
9
10* Google Tag Manager (GTM)
11* Google Analytics (GA)
12* Google Data Studio (GDS)
13* jQuery
14
15## Integration visualised
16![alt text](img/flowchart.png "Logo Title Text 1")
17
18## Functional resume
19
20As can be seen from the /dist/measurement-framework.js file, a structured set of operations coupled with the use of a standardized and generic naming convention ensures desired functionality.
21
22Basically outlined, the above allows for the placement of consumers in segments based on consumer behavior, by utilizing cookie based data and accumulating (n) number of (x,y or z) events. The events used can be defined independently, but it is recommended to use generic event names, as this increases scalability significantly.
23
24Exemplary segments could be:
25
26* Aware
27* Interested
28* Considering
29* Store Visit Intent
30* Ecommerce Intent
31* Ecommerce Purchase
32
33## The backbone of RMF
34
35The following files can be found in the lib folder and are the backbone of the RMF. The below list presents these files and explains their functional intent.
36
37* **ajaxComplete.js (jQuery)**
38 * A set of operations that configures the tracking of asynchronous javascript and xml (AJAX).
39
40* **clientIdSetter.js**
41 * An operation that fetches the client ID (a numeric value that will be added to every call towards GA).
42
43* **contentEngaged.js**
44 * A set of operations to measure consumer engagement based on i.e. clicks, movement, scrolls etc. A predetermined threshold (usually between 15-20 seconds of activty) defines when a consumer is considered engaged in page content or not.
45
46* **customTask.js**
47 * A set of operations that utilizes the recently released task API from Universal Analytics, which lets you modify a dispathed payload fired to GA. Enabling the sending of i.e. client ID to GA.
48
49* **domReady.js**
50 * A set of operations that allows document object model (DOM) ready events to be fired to GA via callback funtionality. (**needs cofirmation from Asim**)
51
52* **klarnaCheckout.js**
53 * An operation that lets you track stages in klarnacheckouts, i.e. shipping address changed, order total changed and cannot complete order.
54
55* **sendHitTask.js**
56 * A set of operations that lets us overwrite the initial hitPayLoad in the measurement protocol request sent to GA servers.
57
58* **userTrail.js**
59 * A set of operations that relies on the use of cookies to store consumer web based actions leading to segmentation of consumers.
60
61## Optimal usage
62As mentioned in the Outline section of this README, RMF is build to integrate and work with GTM, GA, GDS and jQuery. Therefore, it is recommended to use standardized procedures in all of the above to ensure validity in collected data and increase scalability of use.
63
64In GA it is important to follow best practice when setting up accounts, as this will impact how RMF data will migrate with GA. This cannot be stressed enough. The following link is a guideline for what a GA audit might consist of:
65
66[GA Audit Checklist] (https://www.distilled.net/resources/google-analytics-audit-checklist/)
67
68Having successfully migrated the RMF data in GA it's recommended to use GDS to visualise the collected data. A link is provided below in which a GDS template is shared in a view link.
69
70Currently the below link is NOT including any data in its charts, albeit a future commit will follow, in which the link will be updated to include data.
71
72[GDS Template] (https://datastudio.google.com/open/1UyxbaJ8fWvwnE5llwyv2Ad1NeJvlZx5C)
73
74The following screenshots show how data sources are added to or removed from the GDS report.
75![alt text](img/manage_data.png "Logo Title Text 1")
76![alt text](img/manag_data.png "Logo Title Text 1")
77
78The next screenshots show how to add data sources. The first screenshot shows the first step in adding data to the GDS report. Choosing a data source, plain and simple, albeit to configure GDS to work optimally, you must either choose a dimension or add another "temporary" data source, then delete it, as shown in the second screenshot, because then you can save your added data source.
79![alt text](img/config_data.png "Logo Title Text 1")
80![alt text](img/add_data.png "Logo Title Text 1")
81
82The final screenshots show the last steps in adding data sources, the two data sources used at RED Dentsu X and the edit and remove options.
83
84![alt text](img/last step.png "Logo Title Text 1")
85![alt text](img/data_sources.png "Logo Title Text 1")
86
87## Installation
88A chronological list is provided below - explaining the installation of RMF:
89
90- Make sure you have installed npm.
91- Run ```npm init``` (makes a package.json file)
92- Run ```npm install i measurement-framework```
93- Copy rollup.config.js to the root directory, from the measurement-framework folder placed within the node-modules folder.
94- From rollup-config.js remove referances to and import of elsint
95- From the measurement-framework folder placed within the node-modules foler, copy the devdependencies in the package.json file and paste in package.json file in the root directory.
96- run ```npm install```
97
98#### Compressing the measurement-framework.js code for GTM
99Finally, to compress the measurement-framework.js file, run the following:
100
101
102- run ```rollup -c```
103
104
105Confirming the compression has been successful, look inside the dist folder.
106If the file is there, copy its contents and make a custom html tag in the desired GTM account.
107In the custom html section, type the following:
108
109```
110<script>
111<between the script tags insert the copied compression of measurement-framework.js>
112</script>
113```
114
115Additionally, the trigger to be used in GTM is "All Pages".
116
117## Note on building with rollup
118Rollup and other javascript compilers do not support removing unused methods from classes. This is why the RMF is running several functions instead of importing a class to hold them. Internally, these use the MeasurementFramework class to hold state and to orchestrate between classes. This makes the package nice and tight.
119
120## Honorable mention
121This work is heavily inspired by *Simo Ahava's* blog workings. Therefore we'd like to thank him for his continued interest in working with and utilizing the possibilities within Google Analytics and Google Tag Manager to propel data driven digital marketing forward.
\No newline at end of file