Description
In this example we'll need to set up GTM custom variables, triggers and tags. This will allow us submitting the required data to Clinch pixel.
Bare in mind, this is an example of the Clinch pixel set up and your final set up might differ.
GTM tags will require custom variables and triggers, so we suggest creating these at first before adding the tags.
Custom variables
As an example, we'll be creating Sport custom variable. Let's visit Variables section in the GTM and click to create a new variable. The final result for the Sport variable should look like this:
In this case we:
- Named the new variable as Sport
- Chose the Variable type to be Data Layer Variable
- Data Layer Variable Name is sport
The most important part here is the Data Layer Variable Name, since this piece of data will be coming from our app and so we need to enter this key correctly.
Other variables should be created using the same principle:
Variable name | Data Layer Variable Name |
---|---|
Amount | amount |
Tournament | tournament |
Country | country |
Bet Type | betType |
Bet Option | betOption |
Game Module | gameModule |
Payment Method | paymentMethod |
Payment Groups | paymentGroups |
Slip UUID | uuid |
Events | events |
Searched Keyword | searchedKeyword |
Triggers
Let's implement triggers according the examples:
Add To Betting Slip - Sports
Event name: gtm-addBetToBettingSlip
Trigger type: Custom Event (GTM predefined)
Game Module (custom variable) regex: live|prematch|prematch-outright|prematch-special
The regex makes sure we are currently catching sports related bets only.
Dom Ready
Add To Favorites
Other triggers
Other triggers should be done the same way as Add To Favorites trigger. The list:
Trigger name | Event name |
---|---|
Deposit Success | gtm-depositSuccess |
Slip Buy | gtm-slipBuy |
Registration Finished | gtm-registrationFinished |
Slip Buy | gtm-slipBuy |
Remove From Betting Slip | gtm-removeFromBettingSlip |
Search Result Click | gtm-searchResultClick |
View Tournament | gtm-viewTournament |
View Single Event | gtm-viewContent |
Tags
Base
Base tag should be the first to fire, before the other Clinch tags and implementation should look like this:
Tag Type: Custom HTML (GTM predefined type)
Trigger: Dom Ready (We created this earlier in the Triggers section)
The script to copy & paste:
<!-- Clinch Pixel Code --> <script type='text/javascript'> !function(c, l, e, v, n, t, s) { if (c.clq) return; n = c.clq = function() { n.callMethod? n.callMethod.apply(n, arguments) : n.queue.push(arguments) }; if (!c._clq) c._clq = n; n.push = n; n.loaded = !0; n.version = '2.0'; n.queue = []; t = l.createElement(e); t.async = !0; t.src = v; s = l.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t, s) } (window, document, 'script', 'https://cdn.clinch.co/a_js/client_pixels/clq/script.min.js'); clq('init', 'xxxx', {'cid':'xxxx', 'product':'ecommerce'}); clq('track', 'PageView'); </script> <!-- End Clinch Pixel Code -->
Please make sure to replace xxxx in the script with your details.
Other tags
The other tags should be created the same as the Base, except for the scripts and triggers being different.
Please bare in mind, the scripts to copy & paste contain custom variables, which we created previously. Custom variable starts and ends with the curly braces -
{{ custom variable name }}
and the naming within the curly braces must match the name of previously created custom variable. If there is a need to correct or add a custom variable name, just delete that particular custom variable name from the script and start typing two opening square brackets - the GTM will show all possible custom variable suggestions, from which we can just pick the right one and GTM will insert the custom variable within the script.
Search
Trigger name: Search Result Click
<script type='text/javascript'> var contentId = {{Sport}} + ', ' + {{Country}} + ', ' + {{Tournament}}; clq('track', 'Search', { content_type: 'product', content_ids: [contentId], search_string: {{Searched Keyword}}, content_category: {{Game Module}}}); </script>
View Category
Trigger name: View Tournament
<script type='text/javascript'> var contentId = {{Sport}} + ', ' + {{Country}} + ', ' + {{Tournament}}; clq('track', 'ViewCategory',{ content_type: 'product', content_ids: [contentId], content_category: {{Game Module}} }); </script>
View Content
<script type='text/javascript'> var contentId = {{Sport}} + ', ' + {{Country}} + ', ' + {{Tournament}}; clq('track', 'ViewContent',{ content_type: 'product', content_ids: [contentId] }); </script>
Trigger name: View Single Event Trigger name: Add To Betting Slip - Sports
Add To Cart
<script type='text/javascript'> var contentId = {{Sport}} + ', ' + {{Country}} + ', ' + {{Tournament}}; var custom1 = {{Bet Type}} + ' | ' + {{Bet Option}}; clq('track', 'AddToCart',{ content_type: 'product', content_ids: [contentId], custom1: custom1}); </script>
Remove from Cart
Trigger name: Remove From Betting Slip
<script type='text/javascript'> var events = {{Events}}; for (var i = 0; i < events.length; i++) { var event = events[i]; var gameModule = event.gameModule; if ( gameModule !== 'live' && gameModule !== 'prematch' && gameModule !== 'prematch-outright' && gameModule !== 'prematch-special' ) { continue; } var contentId = event.sport + ', ' + event.country + ', ' + event.tournament; var custom1 = event.betType + ' | ' + event.betOption; clq('track', 'RemFromCart', {content_type: 'product', content_ids: [contentId], custom1: custom1}); } </script>
Add To Wishlist
Trigger name: Add To Favorites
<script type='text/javascript'> var contentId = {{Sport}} + ', ' + {{Country}} + ', ' + {{Tournament}}; var clinchAddToWishlistParams = {content_type: 'product', content_ids: [contentId]}; if ({{Bet Type}}) { clinchAddToWishlistParams['custom1'] = {{Bet Type}}; } clq('track', 'AddToWishlist', clinchAddToWishlistParams); </script>
Purchase Conversion
Trigger name: Slip Buy
<script type='text/javascript'> var events = {{Events}}; for (var i = 0; i < events.length; i++) { var event = events[i]; var gameModule = event.gameModule; if ( gameModule !== 'live' && gameModule !== 'prematch' && gameModule !== 'prematch-outright' && gameModule !== 'prematch-special' ) { continue; } var contentId = event.sport + ', ' + event.country + ', ' + event.tournament; var custom1 = event.betType + ' | ' + event.betOption; clq('track', 'Purchase',{ value: {{Amount}}, currency: 'ZAR', content_type: 'product', content_ids: [contentId], order_id: {{Slip UUID}}, subType: 'Bet placed', custom1: custom1 }); } </script>
Deposit Conversion
Trigger name: Deposit Success
<script type='text/javascript'> clq('track', 'Purchase',{ value: {{Amount}}, currency: 'ZAR', content_type: 'product', content_ids: [{{Payment Method}}], subType: 'deposit', custom1: {{Payment Groups}}}); </script>
Registration Complete
Trigger name: Registration Finished
<script type='text/javascript'> clq('track', 'CompleteRegistration'); </script>