Must know:
-
Most of the events that your users trigger on your website or app are not sent one at a time. Instead, most events are grouped together (or batched).
Events are not batched, however, in some circumstances:
-
Key events are transmitted immediately, although they may be part of a batch
-
Containers loaded in debug mode never batch events to facilitate the realtime experience
-
Events that are held by your device are sent when a user leaves a page
-
In browser environments that don't support the
sendBeacon
API, all events are sent immediately
2. All new custom events start working in google analytics ~24 hours after publication.
Table of contents:
-
general setup
-
setup variables
-
setup triggers
-
setup tags
-
preview and testing
-
publish custom events
-
related video tutorials
1. General setup
Open https://tagmanager.google.com/#/home
Click “Create Account”
Fill out the form:
Account - will be common for your company and can have few containers, usually 1 per website. Select Web and Create.
Agree with the Terms of Service, click Yes.
Close the “Install Google Tag Manager” window.
You are now in the container workspace. In the top right corner you can see the code (in my case - “GTM-TNB6ZHN6”), which you will need to send in the website. gtm field for your Widget app.
Open Google analytics https://analytics.google.com/ and create New account.
On “Start collecting data” select web.
Enter the url of the website and name. Press Create stream.
Close the “Installation instructions” window.
Copy and save Measurement id, you will need it soon to connect the Google Analytics to the Google Tag Manager.
Go to the Google tag manager page, open Tags and click the “New” button.
Click Tag configuration - click Google Analytics - click Google Tag Put your Measurement id in the Tag ID field.
Click Triggering - select “Initialisation - All pages”.
Name this tag and click save.
2. Setup variables
Go to the Variables page. User-defined variables - click New
Let’s add the Measurement id first.
Click Variable configuration - Utilities - click Constant. Add the Measurement id in the Value field, name variable “ga4 measurement id” and Save.
Now add variables for our GTA events User-defined variables - click New.
Click Variable configuration - Page variables - click Data Layer Variable.
Name variable “order_currency” same for Data Layer Variable Name and Save.
Add in the same way these variables:
order_id
order_value_before_discount
order_value_after_discount
product_id
product_price
product_count
venue_name
service_name
3. Setup triggers
Go to the Triggers page. Click New - Trigger configuration - Custom event
Event name: widget_choosing_location
Save.
-png.png?width=1385&height=681&name=image%20(8)-png.png)
Add in the same way this triggers:
widget_open
widget_place_order
widget_promotion_redeemed
widget_skip_upsell
widget_upsell_added
-png.png?width=1686&height=496&name=image%20(9)-png.png)
4. Setup tags
Go to the Tags page. You should have Google tag that we add before.
Now let’s add Google analytics event tags.
Click New.
Click Triggering - select one of our custom triggers - widget_choosing_location.
Click Tag configuration - Google Analytics - Google Analytics: GA4 Event
Measurement id field: select the “ga4 measurement id variable”.
Add event name: widget_choosing_location
Event parameters - Add parameter.
Type venue_name in the left field and select “venue_name” variable in the right field.
Add second parameter
Type service_name in the left field and select “service_name” variable in the right field.
Name tag and save.
-png.png?width=1719&height=1137&name=image%20(11)-png.png)
Add more custom tags in the same way:
Open ordering widget tag (no variables)
Place order tag (make sure you add all 4 variables: order_id, order_value_before_discount, order_value_after_discount, order_currency)
Promotion redeemed tag (no variables: )
-png.png?width=1491&height=649&name=image%20(14)-png.png)
Skip upsell tag (no variables)
Upsell added tag (3 variables: product_id, product_price, product_count)
5. Preview and testing
Send your GTM (Google tag manger) key to your BOSS IT support contact and they will input on backend of your site. Once this is confirmed to be done go to next step.
In the top right corner press Preview button.
Install Tag Assistant Companion https://chromewebstore.google.com/detail/tag-assistant-companion/jmekfmbnaedfebfnmakmokmlfpblbfdm
Add website url (widget url, it will ends with .bossit.cloud) and press Connect.
Do all the things what you want to test in the opened window.
You can see how events works in the Tag assistant:
In the Google Analytics go to Administrator - DebugView.
You can see how events works here and check field values (like product_id).
-png.png?width=688&height=436&name=image%20(20)-png.png)
6. Publish custom events
Finally Submit and Publish events in the GTM.
At the 24 hours you will start to see your custom events.
7. Related video tutorials:
GTM and GA overview.
Custom events setup. (Highly recommend to view)