facebook-pixel-and-fresh8

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
facebook-pixel-and-fresh8 [2022/11/22 07:21] – [Subscribe] evaldas-luksysfacebook-pixel-and-fresh8 [2024/04/11 12:09] (current) – [Triggers] evaldas-luksys
Line 8: Line 8:
  
 Other events are optional, but the more are added, the better result can be achieved. Other events are optional, but the more are added, the better result can be achieved.
 +
 +Please note, javascript code snippets in the screenshots were added just for display purposes. The correct code snippets are next to the screenshots and these should be pasted in Google Tag Manager.
  
 ====== Custom variables ====== ====== Custom variables ======
  
-In some code snippets we use <code>{{variable name}}</code>These variables represent data sent from our app. For instance, when user adds bet to betting slip, **addBetToBettingSlip** event is sent with some data, e.g. event UUID, market and etc... So each <code>{{variable}}</code> created represents single piece of data, which then can be used in Tags.+In some code snippets we use <code>{{variable name}}</code>These variables represent data sent from our app. For instance, when user adds bet to betting slip, **gtm-addBetToBettingSlip** event is sent with some data, e.g. event UUID, market and etc... So each <code>{{variable}}</code> created represents single piece of data, which then can be used in Tags
 + 
 +For custom variable list please read Custom variables section.
  
 ====== Triggers ====== ====== Triggers ======
 Some of the Tags are using triggers. Trigger is basically and event sent from our app. We need to create a trigger for each event, and then those triggers are assigned to Tags. Some of the Tags are using triggers. Trigger is basically and event sent from our app. We need to create a trigger for each event, and then those triggers are assigned to Tags.
 +
 +For trigger list please read triggers section.
  
 ====== GTM Tags ====== ====== GTM Tags ======
Line 65: Line 71:
   var url = 'https://pixel.fresh8.co/' + operatorID + '/' + eventIDS[0] + '?type=ViewContent'   var url = 'https://pixel.fresh8.co/' + operatorID + '/' + eventIDS[0] + '?type=ViewContent'
   var ids = new Request(url);   var ids = new Request(url);
-    fetch(ids).then(function(res) {+    fetch(ids) 
 +      .then(function(res) {
         return res.json();         return res.json();
-    }).then(function(data) { +      }).then(function(data) { 
-    fbq('track', 'ViewContent', { content_type: 'product', content_ids: data, content_name: {{Content name}} }); +        fbq('track', 'ViewContent', { 
-  });+          content_type: 'product', 
 +          content_ids: data, 
 +          content_name: {{Content name}} 
 +        }); 
 +      }) 
 +       // When user uses ad blocker, request throws unhandled error. Catch prevents this.  
 +      .catch(function() {});
 </script> </script>
 </code> </code>
Line 85: Line 98:
   var market = {{market}}   var market = {{market}}
   var ids = new Request(url);   var ids = new Request(url);
-    fetch(ids).then(function(res) {+    fetch(ids) 
 +      .then(function(res) {
         return res.json();         return res.json();
-    }).then(function(data) { +      }) 
-    fbq('track', 'AddToCart', {content_name: {{Content name}}, content_ids: data, content_type: 'product', contents: [{'id': selection + '|' + market, 'quantity': 1}]}); +      .then(function(data) { 
-  });+        fbq( 
 +          'track', 
 +          'AddToCart', 
 +          { 
 +            content_name: {{Content name}}, 
 +            content_ids: data, 
 +            content_type: 'product', 
 +            contents: [{'id': selection + '|' + market, 'quantity': 1}]} 
 +         ); 
 +      // When user uses ad blocker, request throws unhandled error. Catch prevents this.  
 +      }).catch(function() {});
 </script> </script>
 </code> </code>
Line 105: Line 129:
  
 {{:online:meta-pixel-fresh8:fb_pixel_lead_tag.jpg|}} {{:online:meta-pixel-fresh8:fb_pixel_lead_tag.jpg|}}
 +
 +Code snippet below. Please replace currency 'EUR' with your currency symbol.
  
 <code> <code>
 <script> <script>
 fbq("track", "Lead", { fbq("track", "Lead", {
-  currency: {{Currency}},+  currency: 'EUR',
   value: 0,   value: 0,
   external_id: {{user ID}},   external_id: {{user ID}},
Line 115: Line 141:
 </script> </script>
 </code> </code>
- 
 ==== Purchase ==== ==== Purchase ====
  
 {{:online:meta-pixel-fresh8:fb_pixel_slip_buy_tag.jpg|}} {{:online:meta-pixel-fresh8:fb_pixel_slip_buy_tag.jpg|}}
 +
 +Please replace currency with your own.
  
 <code> <code>
Line 127: Line 154:
   var url = 'https://pixel.fresh8.co/' + operatorID + '/' + eventIDSAsString + '?type=Purchase'   var url = 'https://pixel.fresh8.co/' + operatorID + '/' + eventIDSAsString + '?type=Purchase'
   var ids = new Request(url);   var ids = new Request(url);
-    fetch(ids).then(function(res) {+    fetch(ids) 
 +      .then(function(res) {
         return res.json();         return res.json();
-    }).then(function(data) { +      }).then(function(data) { 
-      fbq('track', 'purchase', {+        fbq('track', 'purchase', {
         content_type: 'product',         content_type: 'product',
         content_ids: data,         content_ids: data,
-        currency: {{Currency}},+        currency: 'EUR',
         value: {{Amount}}         value: {{Amount}}
-      }); +        }); 
-  });+      }) 
 +      // When user uses ad blocker, request throws unhandled error. Catch prevents this.  
 +      .catch(function() {});
 </script> </script>
 </code> </code>
Line 153: Line 183:
  
 {{:online:meta-pixel-fresh8:fb_pixel_complete_registration.jpg|}} {{:online:meta-pixel-fresh8:fb_pixel_complete_registration.jpg|}}
 +
 +Please replace currency with your own.
  
 <code> <code>
 <script> <script>
   fbq("track", "CompleteRegistration", {   fbq("track", "CompleteRegistration", {
-    currency: {{Currency}},+    currency: 'EUR',
     external_id: {{user ID}},     external_id: {{user ID}},
     value: {{Amount}}      value: {{Amount}} 
Line 167: Line 199:
  
 {{:online:meta-pixel-fresh8:fb_pixel_subscribe_tag.jpg|}} {{:online:meta-pixel-fresh8:fb_pixel_subscribe_tag.jpg|}}
 +
 +Please replace currency with your own.
  
 <code> <code>
Line 172: Line 206:
   fbq("trackCustom", "Subscribe", {   fbq("trackCustom", "Subscribe", {
     value: {{Amount}},     value: {{Amount}},
-    currency: {{Currency}},+    currency: 'EUR',
     external_id: {{user ID}}     external_id: {{user ID}}
   });   });
Line 199: Line 233:
 {{:online:meta-pixel-fresh8:custom_variable_market.jpg|}} {{:online:meta-pixel-fresh8:custom_variable_market.jpg|}}
  
-==== {{Currency}} ==== 
-{{:online:meta-pixel-fresh8:custom_variable_currency.jpg|}} 
  
 ==== {{user ID}} ==== ==== {{user ID}} ====
Line 207: Line 239:
 ==== {{Amount}} ==== ==== {{Amount}} ====
 {{:online:meta-pixel-fresh8:custom_variable_amount.jpg|}} {{:online:meta-pixel-fresh8:custom_variable_amount.jpg|}}
 +
 +==== {{depositsCount}} ====
 +{{:online:meta-pixel-fresh8:custom_variable_deposits_count.jpg|}}
 +
 +==== More information about other possible data layer variables can be found here ====
 +https://wiki.advbet.com/admin/online-platform-cms/google-events#events-and-their-data
  
  
 ====== Triggers ====== ====== Triggers ======
  
 +Bare in mind, that event names in the screenshots might be out of date. For up to date event names please visit this page: https://wiki.advbet.com/admin/online-platform-cms/google-events?s[]=google&s[]=tag&s[]=manager#events-and-their-data-gtm
 ==== Pageview ==== ==== Pageview ====
  
Line 232: Line 271:
  
 {{:online:meta-pixel-fresh8:first_deposit_success_trigger.jpg|}} {{:online:meta-pixel-fresh8:first_deposit_success_trigger.jpg|}}
 +
 +==== Subsequent deposit success ====
 +
 +{{:online:meta-pixel-fresh8:subsequent_deposit_success_trigger.jpg|}}
 +
 +==== Add to slip event ====
 +
 +{{:online:meta-pixel-fresh8:add_to_slip_trigger.jpg|}}
  • facebook-pixel-and-fresh8.1669101685.txt.gz
  • Last modified: 2022/11/22 07:21
  • by evaldas-luksys