Salesforce

Directly Implement the Pixel On Your Website

« Go Back
Information
pixel-direct-implementation
Directly Implement the Pixel On Your Website
Article Details

Directly Implement the Pixel On Your Website

To directly implement the Pixel on your website: 

  1. Log in to Ads Manager. Then click the menu in the top corner and select Pixels.

  2. Make sure that your website and any webpages are eligible for the pixel, in line with the Snap Personal Data Terms and our privacy and security FAQs. 

  3. Click Create Pixel in the top right corner and give your pixel a name

  4. Select the ad accounts you’d like to share the pixel to by typing the ad account name in the search box.

  5. Select the Set up Pixel button in the top right corner and click Pixel Code.

  6. Within your code base, find the header template, and copy and paste the code from step 1. 

  7. Pass a user parameter.

  • For Snap to potentially match your browser, it’s highly encouraged to pass a user parameter (email or phone number). Both values will be SHA256 natively within our SDK before being passed to Snap’s server.

  • This must be done within the “init” call

  • Multiple parameters can be passed:

snaptr(‘init’, ‘xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’,

{ user_hashed_phone_number:user.sha256_phone_number,

'user_email':user.email });

User Parameter

Description

Example

Requirement 

user_email

 Email   address of   currently   signed in   user. Accepts a single value or a list.

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',   {'user_email':user.email});

OR

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',   {'user_email':[user.email1, user.email2]});

 

Strongly Recommended
(unless you plan to pass user_hashed_email)

ip_address

 IP address   of the   device

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',   {ip_address:user.ip_address});

Recommended

user_phone_number

Only digits with country code, area code and number. No other formatting characters (i.e., not 1+815-483-4610). Accepts a single value or a list.

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',   {user_phone_number:user.phone_number});

OR

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',   {user_phone_number:[user.phone_number1, user.phone_number2]});

Strongly Recommended
(unless you plan to pass user_hashed_phone_number)

user_hashed_email

SHA256 hash of lower cased and white space removed email address. Accepts a single value or a list.

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', {user_hashed_email:user.sha256_email});

OR

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', {user_hashed_email:[user.sha256_email1, user.sha256_email2]});

Strongly Recommended
(unless you plan to pass user_email)

user_hashed_phone_number

SHA256 hash of lowercase and white space removed phone number. Accepts a single value or a list.

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', {user_hashed_phone_number:user.sha256_phone_number});

OR

snaptr('init',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', {user_hashed_phone_number:[user.sha256_phone_number1, user.sha256_phone_number2]});

Strongly Recommended
(unless you plan to pass user_phone_number)

 

The Snapchat Click ID or ScCid is a parameter that is automatically attached to your ad's landing page URLs. When a Snapchatter clicks on an ad and lands on your website, an ID is created and appended to the URL. The variable name can be passed as either ScCid or sccid. Snapchat Click IDs help you to match users and attribute events to your Snapchat ads accurately. No action is needed for your pixel integration to enable this. However, if you do plan to also set up a Conversions API integration, we highly recommend you share the click ID in conversion requests - find more information in our Marketing API documentation.

In addition to one of the above parameters, we now also recommend passing one or a combination of the parameters below to help improve match rates. This data will be passed to us in plaintext; however, the SDK will automatically hash all fields before sending to Snap (there is no need to manually hash these fields):

First Name

firstname

Last Name

lastname

City

geo_city

State

geo_region

Zip Code

geo_postal_code

Country

geo_country

Age

age


For the best performance, you should always send additional parameters if they are available.

      8. Configure passing standard events and standard parameters.

  • Passing at least one standard event is required for attribution 

  • Passing currency, price, and transaction ID are required for accurate ROAS reporting

  • There are many ways to pass event tracking data 

    • Tracking within a webpage example: 

      • <‍button onClick="snaptr('track', 'ADD_CART', { 'currency': 'USD', 'price': 333.33, item_ids': ['097man', ‘16span’] });">Add To Cart</button‍>

    • Tracking with a custom JS function: 

      • function onPurchaseClick() {snaptr('track', 'PURCHASE', { 'currency': 'USD', 'price': $price, 'item_category': $category, 'item_ids': [$item_id] }); };

Event Type

Description

Example

PURCHASE

Track purchases

snaptr('track','PURCHASE')

SAVE

Track add to wishlist events of specific items 

snaptr('track','SAVE')

START_CHECKOUT

Track checkout events

snaptr('track','START_CHECKOUT')

ADD_CART

Track add to cart events of specific items

snaptr('track','ADD_CART')

APP_OPEN

Track app opens

snaptr('track', 'APP_OPEN')

VIEW_CONTENT

Track content view events

snaptr('track','VIEW_CONTENT')

ADD_BILLING

Track payment info configuration status

snaptr('track','ADD_BILLING')

SIGN_UP

Track user registration methods

snaptr('track','SIGN_UP')

SEARCH

Track search events

snaptr('track','SEARCH')

PAGE_VIEW

Track webview pages

snaptr('track','PAGE_VIEW')

SUBSCRIBE

Track subscriptions

snaptr('track','SUBSCRIBE')

AD_CLICK

Track advertisement clicks

snaptr('track','AD_CLICK')

AD_VIEW

Track advertisement views

snaptr('track','AD_VIEW')

COMPLETE_TUTORIAL

Track tutorial completions

snaptr('track','COMPLETE_TUTORIAL')

LEVEL_COMPLETE

Track level completions

snaptr('track','LEVEL_COMPLETE')

INVITE

Track invitations

snaptr('track','INVITE')

LOGIN

Track logins

snaptr('track','LOGIN')

SHARE

Track shares

snaptr('track','SHARE')

RESERVE

Track reservations

snaptr('track','RESERVE')

ACHIEVEMENT_UNLOCKED

Track achievement unlocks

snaptr('track','ACHIEVEMENT_UNLOCKED')

ADD_TO_WISHLIST

Track adds to a wishlist

snaptr('track','ADD_TO_WISHLIST')

SPENT_CREDITS

Track credits spent

snaptr('track','SPENT_CREDITS')

RATE

Track rates

snaptr('track','RATE')

START_TRIAL

Track trials started

snaptr('track','START_TRIAL')

LIST_VIEW

Track viewership of lists

snaptr('track','LIST_VIEW')

CUSTOM_EVENT_1

Track up to 5 custom events

snaptr('track','CUSTOM_EVENT_1')

CUSTOM_EVENT_2

Track up to 5 custom events

snaptr('track','CUSTOM_EVENT_2')

CUSTOM_EVENT_3

Track up to 5 custom events

snaptr('track','CUSTOM_EVENT_3')

CUSTOM_EVENT_4

Track up to 5 custom events

snaptr('track','CUSTOM_EVENT_4')

CUSTOM_EVENT_5

Track up to 5 custom events

snaptr('track','CUSTOM_EVENT_5')

 

Event Parameter

Description

Value

Example

price

Value of the purchase 

Float

snaptr('track', 'PURCHASE', {'currency': 'USD', 'price': 333.33, 'transaction_id':'11111111' });

All three fields are required for return on ad spend (ROAS) reporting 

client_dedup_id

UUID unique to an event. Useful is leveraging Conversions API or another direct integration

String

snaptr('track', 'PURCHASE', { "client_dedup_id": "abc123"})

currency

Standard ISO 4217 code, e.g., EUR, USD, JPY

String

snaptr('track', 'PURCHASE', {'currency': 'USD', 'price': 333.33, 'transaction_id':'11111111' });

All three fields are required for return on ad spend (ROAS) reporting 

transaction_id

Specific ID to an order or transaction 

String

snaptr('track', 'PURCHASE', {'currency': 'USD', 'price': 333.33, 'transaction_id':'11111111' });

All three fields are required for return on ad spend (ROAS) reporting 

item_ids

International Article Number (EAN) when applicable, or other product or category identifier

List

snaptr('track', 'VIEW_CONTENT',{'item_category': 'Shoes',
'item_ids':['097man', '16span']});

item_category

Item or category

String

snaptr('track', 'VIEW_CONTENT',{'item_category': 'Shoes',
'item_ids':['097man', '16span']});

description

A string description for additional info

String

snaptr('track', 'PAGE_VIEW', {description: 'new_landing_page'});

search_string

The text that was searched

String

snaptr('track', 'SEARCH', {'search_string': 'boots'});

number_items

Number of items

Int

snaptr('track', 'ADD_CART', {'number_items': 2 });

payment_info_available

Payment info available
1 for yes, 0 for no

0 or 1

snaptr('track','START_CHECKOUT', {payment_info_available:1}

sign_up_method

Facebook, Email, Twitter, etc.

String

snaptr('track','PAGE_VIEW', {sign_up_method:'Snapchat'}

success

Success
1 for yes, 0 for no

0 or 1

snaptr('track','SIGN_UP', {success:1}

brands

Brands associated with the item_ids of the conversion event

List

snaptr('track', 'VIEW_CONTENT', {
  'item_category': 'Shoes',
  'item_ids': ['097man', '16span'],
  'brands': ['brand01', 'brand02']
});

delivery_method

Delivery method of the product
Suggested values:
in_store | curbside | delivery

String

snaptr('track', 'PURCHASE', {
  'delivery_method': 'in_store'
});

customer_status

Registration status of the customer
Suggested values:
new | returning | reactivated

String

snaptr('track', 'PURCHASE', {
  'customer_status': 'new'
});

event_tag

Custom tag associated with your event. For example, “back-to-school campaign”

String

snaptr('track', 'PURCHASE', {
  'event_tag': 'back-to-school campaign'
});

partner_provided_id

Partner or CRM identifier for the user

String

snaptr('track', 'PURCHASE', {
  'partner_provided_id': 'crm-user-456'
})

lead_id

This is the identifier associated with your Snapchat Lead Ad.
Do not hash.

String

snaptr('track', 'PURCHASE', {
 'lead_id': 'lead-789'
})

external_id

A unique ID such as a loyalty card ID, first party cookie identifier, or some other identifier. Hashing recommended

String

snaptr('track', 'PURCHASE', {
 'external_id': 'adv-user-123'
})

 

View some examples of correct implementations here.


Powered by