Cookie Variables for Server Side

Facebook Pixel and GTM tracking setup guide


নিচে table করে দিলাম। সব DLV variable বানানোর সময়:

Setting

Value

Variable Type

Data Layer Variable

Data Layer Version

Version 2

Set Default Value

OFF

Server Side Ready Variable Table

GTM Variable Name

Data Layer Variable Name

Use

DLV - Event Name

event

Event identify

DLV - Event ID

event_id

Pixel + Server deduplication

DLV - Timestamp

timestamp

Event time

DLV - Page Type

page_type

Page/category identify

DLV - Ecommerce Currency

ecommerce.currency

Currency

DLV - Ecommerce Value

ecommerce.value

Final value

DLV - Ecommerce Items

ecommerce.items

Product items array

DLV - Ecommerce Shipping

ecommerce.shipping

Delivery charge

DLV - Ecommerce Tax

ecommerce.tax

Tax

DLV - Ecommerce Coupon

ecommerce.coupon

Coupon code

DLV - Transaction ID

ecommerce.transaction_id

Order ID

DLV - Payment Type

ecommerce.payment_type

Payment method

DLV - FB Event Name

fb_event_name

Meta event name

DLV - FB Content IDs

fb_content_ids

Product IDs

DLV - FB Contents

fb_contents

Meta contents array

DLV - FB Content Type

fb_content_type

Product/content type

DLV - FB Value

fb_value

Meta value

DLV - FB Currency

fb_currency

Meta currency

DLV - FB Num Items

fb_num_items

Number of items

DLV - User Phone

user_data.phone

CAPI user data

DLV - User Email

user_data.email

CAPI user data

DLV - User First Name

user_data.first_name

CAPI user data

DLV - User Last Name

user_data.last_name

CAPI user data

DLV - User City

user_data.city

CAPI user data

DLV - User State

user_data.state

CAPI user data

DLV - User Zip

user_data.zip

CAPI user data

DLV - User Country

user_data.country

CAPI user data

DLV - User Address

user_data.address

CAPI user data

DLV - External ID

user_data.external_id

CAPI matching

Cookie Variables for Server Side

এগুলা Data Layer Variable না। এগুলার type হবে 1st Party Cookie।

GTM Variable Name

Cookie Name

Variable Type

Use

1P Cookie - _fbp

_fbp

1st Party Cookie

Meta browser ID

1P Cookie - _fbc

_fbc

1st Party Cookie

Meta click ID

Built-in Variables Enable করো

GTM → Variables → Built-in Variables → Configure থেকে এগুলা tick দাও:

Built-in Variable

Use

Page URL

Server side event source URL

Page Path

Page path

Page Hostname

Domain

Referrer

Referral source

Click URL

Button/link click tracking

Click Text

Button text tracking

Click Classes

Button class tracking

Click ID

Button ID tracking

সবচেয়ে important server-side এর জন্য:

Must Have

Why

DLV - Event ID

Browser + Server duplicate ঠেকাতে

DLV - FB Value

Meta value পাঠাতে

DLV - FB Contents

Product data পাঠাতে

DLV - User Phone

CAPI match quality বাড়াতে

1P Cookie - _fbp

Meta browser ID

1P Cookie - _fbc

Meta click ID

Browser + Server Deduplication Rule

Rule

কী করবেন

Same action

Browser Pixel + Server CAPI দুই জায়গায় একই event পাঠাবেন

Same event name

Purchase হলে দুই জায়গায় Purchase হবে

Same event ID

Browser-এর eventID এবং Server-এর event_id same হবে

Purchase

transaction_id অবশ্যই unique হবে

Refresh issue

Thank You page refresh হলে duplicate Purchase আটকাতে Order ID based blocking রাখবেন

Custom JavaScript Variable to push multiple products info from Array:

Variable Name: cJS - FB - Purchase Product ID

function() {

var items = {{dlv - FB - Purchase Product}};

return items.map(function(items) { return items.item_id; }).join();

}

Variable Name: cJS - FB - Purchase Product Name

function() {

var items = {{dlv - FB - Purchase Product}};

return items.map(function(items) { return items.item_name; }).join();

}

What to do After Setting up Facebook Pixel:

  1. Connecting Pixel with Ad Account

  2. Connecting Pixel with Facebook Catalog

  3. Domain Verification

  4. Setup Aggregated Event Measurement for iOS 14 update

Improve Facebook Event Match Quality

Other data you can include to improve matching accuracy include -

  1. Date of birth

  2. Gender

  3. Address (city, state, postcode, country code)

  4. Subscription ID

  5. External ID

Source:

Pageview: Web

Parameter

Value

fbc

_fbc

fbp

_fbp

first_party_collection

true

Pageview: Server

Parameter

Value

x-fb-ck-fbc

_fbc

x-fb-ck-fbp

_fbp

first_party_collection

true

ViewContent: Web

Parameter

Value

fbc

_fbc

fbp

_fbp

first_party_collection

true

ViewContent: Server

Parameter

Value

x-fb-ck-fbc

_fbc

x-fb-ck-fbp

_fbp

first_party_collection

true

Add to cart: Web

Parameter

Value

fbc

_fbc

fbp

_fbp

first_party_collection

true

Add to cart: Server

Parameter

Value

x-fb-ck-fbc

_fbc

x-fb-ck-fbp

_fbp

first_party_collection

true

Checkout: Web

Parameter

Value

fbc

_fbc

fbp

_fbp

first_party_collection

true

Checkout: Server

Parameter

Value

x-fb-ck-fbc

_fbc

x-fb-ck-fbp

_fbp

first_party_collection

true

Purchase: Web

Parameter

Value

fbc

_fbc

fbp

_fbp

first_party_collection

true

client_ip_address


external_id

visitor id

client_user_agent








Purchase: Server

Parameter

Value

x-fb-ck-fbc

_fbc

x-fb-ck-fbp

_fbp

first_party_collection

true

user_data.email_address


user_data.address.first_name


user_data.address.last_name


user_data.phone_number


user_data.address.city


user_data.address.postal_code


user_data.address.country


client_ip_address


external_id


client_user_agent


Web Container:

content_type ------- product

content_name ------- products.0.name

content_ids -------- products.0.id

value -------------- products.0.price

currency ----------- currency

fbp ---------------- _fbp

fbc ---------------- _fbc

em ----------------- eventModel.user_data.email_add

ph ----------------- eventModel.user_data.phone_number

fn ----------------- eventModel.user_data.address.first_name

ln ----------------- eventModel.user_data.address.last_name

ct ----------------- eventModel.user_data.address.city

st ----------------- eventModel.user_data.address.region

country ------------ eventModel.user_data.address.country

zp ----------------- eventModel.user_data.address.postal_code

external_id -------- userId

Server Container:

x-fb-ck-fbp ---------------- _fbp

x-fb-ck-fbc ---------------- _fbc

first_party_collection ----- true

  1. https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters

  2. https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/custom-data

JavaScript Variable: For Germany Site

function() {

return ({{Transaction Total}}/100);

}

  1. ViewContent Event:

<script>

fbq('track','ViewContent',{

content_type: 'product',

content_ids: {{dlv - fb - product id}},

content_name: {{dlv – fb - product name}},

value: {{dlv – fb - product price}},

currency: 'BDT'

});

</script>

Tag

Use Facebook Tag Template for ViewContent Event

Trigger

Event equals: view_item

Variable & Parameters

  1. content_type - ( product or product_group )

  2. content_name

  3. content_ids

  4. value

  5. currency

  6. event_id

Data Layer Variables (Name - Data Layer Variable):

dlv - fb - product id : ecommerce.items.0.item_id

dlv – fb - product price : ecommerce.items.0.price

dlv – fb - product name : ecommerce.items.0.item_name

dlv – fb - currency : ecommerce.currency

  1. Add to cart Event


<script>

fbq('track','AddToCart',{

content_type: 'product',

content_ids: {{dlv - fb - product id}},

content_name: {{dlv – fb - product name}},

value: {{dlv – fb - product price}},

currency: 'BDT'

});

</script>




Tag

Use Facebook Tag Template for AddToCart Event

Trigger

Event equals: add_to_cart

Variable & Parameters

  1. content_type - ( product or product_group )

  2. content_name

  3. content_ids

  4. value

  5. currency

  6. event_id



Data Layer Variables (Name - Data Layer Variable):


dlv - fb - product id : ecommerce.items.0.item_id

dlv – fb - product price : ecommerce.items.0.price

dlv – fb - product name : ecommerce.items.0.item_name

dlv – fb - currency : ecommerce.currency

  1. InitiateCheckout Event:


Tag

Use Facebook Tag Template for InitiateCheckout Event

Trigger

Event equals: begin_checkout

Variable & Parameters

  1. content_type ( product or product_group )

  2. content_name

  3. content_ids

  4. value

  5. currency

  6. event_id



Data Layer Variables (Name - Data Layer Variable):


dlv - FB - Purchase value : ecommerce.value


dlv - FB - Purchase Product : ecommerce.items



Custom JavaScript Variable to push multiple products info from Array:


Variable Name: cJS - FB - Purchase Product ID

function() {

var items = {{dlv - FB - Purchase Product}};

return items.map(function(items) { return items.item_id; }).join();

}


Variable Name: cJS - FB - Purchase Product Name

function() {

var items = {{dlv - FB - Purchase Product}};

return items.map(function(items) { return items.item_name; }).join();

}


=============================================


InitiateCheckout Event

Step

কোথায় সেট করবেন

কী send করবেন

1

DataLayer Event

event: "begin_checkout" বা Meta naming রাখতে চাইলে event: "InitiateCheckout"

2

GTM Trigger

Custom Event Trigger: begin_checkout / InitiateCheckout

3

GA4 Event Tag

Event Name: begin_checkout

4

GA4 Parameters

currency, value, coupon, items

5

Meta Browser Pixel

Event Name: InitiateCheckout

6

Meta Parameters

eventID, content_ids, content_type: "product", contents, value, currency, num_items

7

Server Side CAPI

Event Name: InitiateCheckout, same event_id, event_source_url, action_source: "website", _fbp, _fbc, user data if available

8

Fire Condition

User checkout page-এ গেলে বা checkout process শুরু করলে fire হবে

9

Important Check

Cart page view-তে fire করবেন না; checkout শুরু না হলে InitiateCheckout fire করা উচিত না

Google-এর ecommerce guide অনুযায়ী checkout-এর first step measure করতে begin_checkout event use করা হয়, আর coupon থাকলে event-level বা item-level coupon পাঠানো যায়।

Checkout event-এ রাখবেন:

Field

Example

ecommerce.value

Cart subtotal / checkout value

ecommerce.currency

BDT / USD

ecommerce.items

Cart-এর সব products

ecommerce.coupon

Coupon থাকলে

fb_content_ids

সব product IDs

fb_contents

ID + quantity + item_price

fb_num_items

Total item quantity



  1. Purchase Event:


<script>

fbq('track', 'Purchase', {

value: {{dlv - FB - Purchase value}},

currency: 'BDT',

content_type: 'product',

content_name: {{cJS - FB - Purchase Product Name}},

content_ids: {{cJS - FB - Purchase Product ID}},

});

</script>



Tag

Use Facebook Tag Template for Purchase Event

Trigger

Event equals: purchase

Variable & Parameters

  1. content_type - ( product or product_group )

  2. content_name

  3. content_ids

  4. value

  5. currency

  6. order_id

  7. event_id



Data Layer Variables (Name - Data Layer Variable):


dlv - FB - Purchase value : ecommerce.value

dlv - FB - Order ID : ecommerce.transaction_id


dlv - FB - Purchase Product : ecommerce.items



=======================================================

Purchase Event

Step

কোথায় সেট করবেন

কী send করবেন

1

DataLayer Event

event: "purchase"

2

GTM Trigger

Custom Event Trigger: purchase

3

GA4 Event Tag

Event Name: purchase

4

GA4 Parameters

transaction_id, value, tax, shipping, currency, coupon, items

5

Meta Browser Pixel

Event Name: Purchase

6

Meta Parameters

eventID, content_ids, content_type: "product", contents, value, currency, num_items, order_id optional

7

Server Side CAPI

Event Name: Purchase, same event_id, event_source_url, action_source: "website", client_user_agent, _fbp, _fbc, hashed email/phone if available

8

Fire Condition

শুধু Thank You / Order Success page-এ fire হবে

9

Important Check

Payment page, checkout page, বা order pending অবস্থায় Purchase fire করবেন না

GA4 purchase event-এ transaction_id, value, tax, shipping, currency, coupon, এবং items পাঠানোর structure Google-এর ecommerce documentation-এ দেখানো আছে।

Purchase value rule:

Field

কী রাখবেন

transaction_id

Unique Order ID

value

Product revenue total; আপনার reporting logic অনুযায়ী final order value রাখতে পারেন

shipping

Delivery charge

tax

Tax/VAT

coupon

Coupon code

items

Purchased products array

currency

BDT / USD

payment_type

COD / bKash / Card — GA4 custom parameter বা separate add_payment_info event-এ better


Previous Post Next Post

نموذج الاتصال