Server side, serverless, server-to-server, scalable from zero to enterprise, cookieless, and ITP compliant cookies, open source, automated data collection and auditing, personalisation data flows for 1 Euro/day
1. Media.Monks Proprietary & Confidential 1
Server side, serverless, server-to-server, scalable from zero to enterprise, cookieless, and ITP
compliant cookies, open source, automated data collection and auditing, personalisation data flows
for 1 Euro/day
8. Media.Monks Proprietary & Confidential 8
Media.Monks Proprietary & Confidential 8
Mar 16, 2022
Prepare for the future with
Google Analytics 4. GA360
sunset announced.
15. Media.Monks Proprietary & Confidential 15
If ever there was a time to
shop around, it's right now.
“
Simo Ahava
@SimoAhava on Server-Side Tag Manager in episode two of Life after GDPR. @LifeAfterGDPR
19. Media.Monks Proprietary & Confidential 19
Media.Monks Proprietary & Confidential 19
I put the thingamabob inside
the whatchamacallit and
turned the doohickey and
measured the whateveritis
for reporting
“
This is what a CMO hears when being told to change from GA4
20. Media.Monks Proprietary & Confidential 20
The Why?
TraCkInG UsErS
Data CAPTURE
Google made me do it
The What?
GA360
GA4?
Matomo?
SnowPlow?
Salesforce?
Adobe?
21.
22. Media.Monks Proprietary & Confidential 22
Tools don’t solve problems.
Processes, culture, and asking
the right questions do.
“
Simo Ahava
@SimoAhava on technical solutionism in the episode two of Life after GDPR. @LifeAfterGDPR
23. Media.Monks Proprietary & Confidential 23
The How?
Are client side 3P JavaScript
libraries the future?
The Why?
TraCkInG UsErS
Data CAPTURE
Google made me do it
The What?
GA360
GA4?
Matomo?
SnowPlow?
Salesforce?
Adobe?
27. Media.Monks Proprietary & Confidential 27
The How?
Server Side
Server to server
Minimise client side - change the architecture
The Why?
Privacy-first
First Class
First Party
Data with purpose
29. Media.Monks Proprietary & Confidential 29
The Why?
Privacy-first
First Class
First Party
Data with purpose
The What?
Infrastructure with incredible versatility
scalability, power, cost effectiveness
The How?
Server Side
Server to server
Minimise client side - change the architecture
31. Client Side - the way it’s always been
Your website
Web Server
Backend
transactional
system
1
2
3
4
32. Server Side - a new dawn is breaking
Your Cloud
Your website
Web Server
Backend
transactional
system
1
2
3
5
4
33. Media.Monks Proprietary & Confidential 33
Media.Monks Proprietary & Confidential 33
Server Side Data Collection
Establish the right foundation: a future-proof, compliant data collection ecosystem
Data Stewardship
Own the data
collection and have
fuller control over
what is collected and
when, leading to
better first party data
quality.
Security
Reduce the
number of scripts
from third parties
being loaded on
your website
pages, better for
security.
Performance
Cloud Run is able to
handle multiple
requests at the
same time and is
able to scale up
based on demand.
Privacy
Using SGTM gives
you more direct
control over
precisely what data
is then shared with
third party vendors.
34. Client Side GTM Server Side GTM
Your 1P cookies [and ITP]
will thank you
35. I promise you Harry, there’s
nothing on this car that
doesn’t do anything
https://youtu.be/ILycsqvRnb4?t=494
“
Gordon Murray
38. Separation of concerns
Transactional
system CDP & CRM
Web Server SGTM GCP
Public facing
Regional
distribution
Private
Data Collection
Content
Data Enrichment
Functionality
media.monks.com
Asynchronous
Promises
39. Separation of concerns
Transactional
system CDP & CRM
Web Server SGTM GCP
Public facing
Regional
distribution
Private
Data Collection
Content
Data Enrichment
Functionality
?
media.monks.com
Asynchronous
Promises
45. Key building block concepts - clients and tags
Your
website
Tag vendor
endpoints
Request
Client
Server
Tag
Server
Tag
https://developers.google.com/tag-platform/tag-manager/server-side/intro
46. Media.Monks Proprietary & Confidential 46
Media.Monks Proprietary & Confidential 46
Key building blocks
https://github.com/tra
kken/gtm-server-tag-
template-write-to-
bigquery
https://github.com/sq
uare/server-to-
server-gtm-client
Client
Server
Tag
When do you tag, and when do you client?
49. Media.Monks Proprietary & Confidential 49
Media.Monks Proprietary & Confidential 49
Media.monks.com has a consent banner (like all sites).
How can we measure interactions without using
Adobe/Google Analytics, cookies?
50. Media.Monks Proprietary & Confidential 50
Consent?
Google
Tag Manager
(Client side)
SGTM
Google
BigQuery
LookerStudio
Custom
Client
Write to
BQ Tag
Cookieless ping
Yes
No
51. Media.Monks Proprietary & Confidential 51
● Newest serverless GCP offering.
● App engine is older technology.
● Scales up elastically
● Scales to zero.
● May offer enhanced performance and
scalability for high volume, high
frequency custom data collection.
Why Cloud Run?
56. Media.Monks Proprietary & Confidential 56
Digital marketing maturity and
advanced use-cases require a
solid foundation to build upon.
Before you can be good at this...
...you need to get this right
Why?
57. Media.Monks Proprietary & Confidential 57
How did Media.Monks help take Mondelēz
from data dystopia to 70% ROI?
1
Get everything
under control
2
Apply
governance rules
and data
standards
3
Unify data in the
cloud
4
Scale it
58. Benefits of Taxonomy
Data Ease Of Working Reporting Audiences Management
Properly defined
taxonomies help you to
organize your data in a
clear and efficient way.
A Global Standardized
Taxonomy provides clear
processes and rules,
creating consistency and
gaining operational
success.
Standardized taxonomy
helps to optimize reporting
through ease of
comparison, and
consistent data across
brands, markets, and
campaigns.
Split and group audiences
based on attributes,
enables greater audience
understanding and
targeting.
A clean and efficient
taxonomy provides ease to
managing campaigns.
A well structured campaign naming convention is the first step in
effective performance reporting and advanced media executions. This
is not possible without a standard taxonomy process.
59. Media.Monks Proprietary & Confidential 59
02
01 03
Taxonomy Automation
Glossary
Data store of
agreed and
expected
campaign ID names
and values
Data Collection
This is coming next
- the secret sauce
Visualise
Use your chosen
data visualisation
tool.
We’ve used
DataStudio on BQ
60. Collect, compare, score
Browser
Full URL
gclid
dclid
utm
SGTM->BQ
Visualise/Compare
collected with
glossary
Write to
BQ Tag
Custom
Client
Web Server
63. Media.Monks Proprietary & Confidential 63
Media.Monks Proprietary & Confidential 63
https://developers.google.com/tag-
platform/tag-manager/server-
side/common-event-data
Server to
Server Client
Server-to-Server
64. Media.Monks Proprietary & Confidential 64
Media.Monks Proprietary & Confidential 64
Server-to-Server
media.monks.com runs both client side and server side data collection. There are two
server side end points. One is a standard GA4 endpoint. The second endpoint has the
capability to accept POST requests that match Google’s Common Event Data Schema.
The client template is the server-to-server template published by Square.
65. SGTM + CDP/CRM/Data Lake
Transactional
system CDP & CRM
SGTM GCP
Data lake
Data Warehouse
JSON Request/
Response
HTTP Request
LTV
Margin
ZPD
IP
Asynchronous
Promises
66. sGTM + Google Ads Conversions
Transactional
system
SGTM GCP
LTV
Margin
ZPD
IP
Firestore
Lookup
variable
Google Ads
conversions
supports setting
the conversion
value using a
variable such as
a Firestore
Lookup variable.
72. Media.Monks Proprietary & Confidential 72
Media.Monks Proprietary & Confidential 72
Personalisation using server side Optimize
Optimize documentation on Server Side testing and personalisation:
● Set the experiment and treatment ID
● Measure using Google Analytics
BUT
● Where does the treatment come from?
● Computation required?
73. SGTM as a CDN?
Your website
3P
Endpoints
CDN
Content
74. Media.Monks Proprietary & Confidential 74
Media.Monks Proprietary & Confidential 74
Caching assets for response payloads
● From documentation: Template data storage allows data to be shared across executions of a single
template.
● Cloud functions prime the cache on sGTM proactively on a schedule or asset update.
● Use specific paths to return or update cache content
if ( getRequestPath () === '/p13n') {
claimRequest();
sendResponse(templateDataStorage.getItemCopy('content'));
}
75. Media.Monks Proprietary & Confidential 75
Media.Monks Proprietary & Confidential 75
Caching assets for response payloads
● From documentation: Template data storage allows data to be shared across executions of a single
template.
● Cloud functions prime the cache on sGTM proactively on a schedule or asset update.
● Use specific paths to return or update cache content
if ( getRequestPath () === '/p13n-update') {
claimRequest();
const update = getRequestQueryParameter('update');
const secret = getRequestQueryParameter('secret');
if (update && secret === 'generated api secret') {
templateDataStorage.setItemCopy('content', update);
sendUpdateResponse(update);
}
76. sGTM as a CDN - Firestore
Your website
Content Requests
Custom p13n
Client
Content Updates
https://www.simoahava.com/analytics/enrich-
server-side-data-with-cloud-firestore/
https://stacktonic.com/article/how-to-export-big-
query-data-to-google-firestore-and-gtm-server
78. Media.Monks Proprietary & Confidential 78
Media.Monks Proprietary & Confidential 78
Prefetch
● Predicting user navigation paths to prefetch site assets - make the site appear to be super fast
● Requires round trip to query the predictive model
Cloud Function
Plumber (R)
App Engine Flex
79. sGTM as a general model endpoint
Your website
Data Requests
Custom Client
Data Updates
81. Media.Monks Proprietary & Confidential 81
Media.Monks Proprietary & Confidential 81
SGTM Maturity Path
● Expect more API integrations
● Extend beyond
○ JSON request, response
○ HTTPS curling between cloud functions
● Full GCP API support?
○ Cloud Storage
○ Pubsub
○ Data workflows
○ More native CDP support
82. Media.Monks Proprietary & Confidential 82
What will data collection look like in 12 months?
Look beyond these parlour tricks
Step away from the browser as a data collection component
Think Why and How as much as the What
Take away
84. Media.Monks Proprietary & Confidential 84
My gift to you to say thanks
for coming! These takeaway
slides cover more technical
detail on the solutions
discussed,
“
Doug Hall
Senior Director of Analytics
Media.Monks
doug.hall@media.monks.com
85. Media.Monks Proprietary & Confidential 85
01 Clients can be multipurpose
Overview
02 When to client and when to tag
03 Bare bones client
04 BQ Integrations
05 Server-to-Server details
87. Media.Monks Proprietary & Confidential 87
Media.Monks Proprietary & Confidential 87
Clients can be multipurpose
● Group similar data input workloads depending on the downstream use
○ Transactions can come from online or offline sources
■ Differentiate by path
○ Conversions need to be recorded in multiple locations (1P, and 3P)
○ Prepare transaction output from the client for multiple tags to consume
● Build a request path taxonomy
○ Use naming convention to express the function of the client
○ Consider internal and external client access
○ Which works best for you to protect clients?
■ Firewall, routing, API secrets
88. Media.Monks Proprietary & Confidential 88
Media.Monks Proprietary & Confidential 88
When to client, when to tag
● Clients are the route in for requests
○ Data
○ Functionality
● Clients have the responsibility
○ clean
○ sanitise
○ distribute output
● Having built a client request taxonomy
○ Does the client do one or more things?
■ Data ingest?
■ What is the nature of the output?
■ Is it generalist, and can it be consumed by multiple endpoints (tag destinations)?
■ There doesn’t always need to be a tag
● Clients operating on internal operations don’t necessarily have to provide an output
● Tags have a more specific purpose to communicate data to given endpoint
91. Media.Monks Proprietary & Confidential 91
Media.Monks Proprietary & Confidential 91
Custom Client prototype
Claim appropriate requests, check for missing data and return appropriate error codes if required.
This is where we can perform enrichment, transformation, and redaction.
if ( getRequestPath () === '/change_this_value) {
claimRequest();
if (!expected_input_1 || !expected_input_2 || !expected_input_n) {
const error = formatAndLogErrorMessage('ERR_BODY_ARR', { actualType: typeof
expected_input_1 },{ actualType: typeof expected_input_1 },{ actualType: typeof
expected_input_n } );
respond(422, error);
return;
}
92. Media.Monks Proprietary & Confidential 92
Media.Monks Proprietary & Confidential 92
Custom Client prototype
If all is well, this is where we farm off the data for the tag to fire, and we return the 200 response:
runContainer({'type':expected_input_1, 'session_ID':expected_input_2,
'timestamp':expected_input_n}, () => {
setResponseHeader('content-type', 'text/javascript');
const origin = getRequestHeader('Origin');
if (origin) {
setResponseHeader('Access-Control-Allow-Origin', origin);
setResponseHeader('Access-Control-Allow-Credentials', 'true');
}
respond(200);
});
93. Media.Monks Proprietary & Confidential 93
Media.Monks Proprietary & Confidential 93
Adjust the call to the endpoint
https://old_cloud_function_endpoint_URL.cloudfunctions.net/change_this_value?session_ID=abc123&type=ye
s-or-no
https://your_sub.domain.com/change_this_value?session_ID=abc123&type=yes-or-no×tamp=2022-06-
20T17:32:52.935Z
94. Media.Monks Proprietary & Confidential 94
Media.Monks Proprietary & Confidential 94
Option #1 Use BigQuery method in the Server Side API
https://developers.google.com/tag-platform/tag-manager/server-side/api#bigquery
Option #2 Use an open source tag template
https://github.com/trakken/gtm-server-tag-template-write-to-bigquery
95. Media.Monks Proprietary & Confidential 95
Media.Monks Proprietary & Confidential 95
Write to BigQuery Tag setup is a simple form
Use a variable
This could be a
lookup
depending on
the
event/client
97. Media.Monks Proprietary & Confidential 97
Media.Monks Proprietary & Confidential 97
Server-to-Server
media.monks.com runs both client side and server side data collection. There are two
server side end points. One is a standard GA4 endpoint. The second endpoint has the
capability to accept POST requests that match Google’s Common Event Data Schema.
The client template is the server-to-server template published by Square.
98. Media.Monks Proprietary & Confidential 98
Media.Monks Proprietary & Confidential 98
Server-to-Server
To prove the functionality of the SGTM server-to-server capability, it’s necessary to
simulate the POST requests using something like curl. A simple test looks like this:
curl -X POST https://tm.monks.com -H 'Authorization: Bearer OUR_SECRET_PHRASE' -H 'Content-Type:
application/json' -d '[{ "event_name": "test_event","client_id": "ABC123" }]'
99. Media.Monks Proprietary & Confidential 99
Media.Monks Proprietary & Confidential 99
Server-to-Server
The Bearer value is the authorization
credential sent with the request to match
the configured value in the client.
The client_id value is required to match
events to existing GA users, if consented
and required, or a default value can be
used to anonymise data.
100. Media.Monks Proprietary & Confidential 100
Media.Monks Proprietary & Confidential 100
Server-to-Server
The preview mode console will show the
event and tags fired as a result:
101. Media.Monks Proprietary & Confidential 101
165%
Appliance retailer increases visibility of transactions
As a relentless innovator in the houseware industry, this Media.Monks client
deployed Consent Mode, and GA4 on their sites. This project successfully
delivered all components to build a scalable technology solution, and a
commercially sound business model to support their growth with significant
improvements in data quality.
102. Media.Monks Proprietary & Confidential 102
40+%
Nemlig gathers new insights and grows conversions by 40%
Denmark’s leading online grocer sets new standards for first party data
collection quality: “With Server-Side Tagging, you can strip all of the personally
identifiable information from users’ sessions before sending data to our
analytics and advertising systems,”
https://marketingplatform.google.com/about/resources/nemlig-gathers-new-insights-and-grows-conversions/