Analytics
Table of Contents
- 1 Table of Contents
- 2 Global GTM tag
- 3 Page titles
- 4 Events
- 5 SendInBlue Analytics
- 5.1 High-level Requirements
- 5.2 API Spec
- 5.2.1 Server and credentials
- 5.2.2 Request
- 5.2.2.1 Body Example
- 5.2.3 Response
Global GTM tag
The following tags should exist on every page, except Admin pages. No need to customize based on environment (e.g. Test, Prod). Same tag is to be shown.
Head
refid
is a variable which indicates:
For Partner of type Partner insert https://fioprotocol.atlassian.net/wiki/spaces/DAO/pages/490307680/Partner+Functionality#Referrer-Profiles ID
For Partner of type Affiliate insert “affiliate”
<script>
window.dataLayer = window.dataLayer || [];
</script>
<script>
dataLayer.push({event: "userData", refid: "uniqueone"})
</script>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-KZHJFJH');</script>
<!-- End Google Tag Manager -->
Body
Immediately after <body> tag.
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KZHJFJH"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
Page titles
Page views are triggered by change in url, therefore every page needs to have a unique url. URLs in red need to be updated, as they are duplicates now.
Events
SendInBlue Analytics
High-level Requirements
Anytime the above event occurs and the user is known (logged in) and has opted in to receiving marketing emails, the server needs to send an event notification to SendInBlue:
If initial opt-in flag (set by user during registration) is not stored on the server, send the request for every user, but expect 404 error to be returned if user has not opted in and is not in SendInBlue db.
There is a way to also send events via js: https://developers.sendinblue.com/docs/gettings-started-with-sendinblue-tracker , but I believe the API method better matches what was already developed for Mailchimp
API Spec
Server and credentials
See https://fioprotocol.atlassian.net/wiki/spaces/DAO/pages/96665686/Emails#Settings
Request
Variable | Type | Value |
---|---|---|
| User’s email address | |
event | Body | Event name as above |
Body Example
{
"email":"bob@gmail.com",
"event":"sign_up"
}
Response
Ignore response