New Facebook Pixel Integration

Hi,

With the new facebook pixel launched how do we integrate it with the cs-cart pages. Where will each of these codes be added in cs-cart (filenames).

Website action	Standard event code
Key page view	fbq('track', 'ViewContent');
Search	fbq('track', 'Search');
Add to cart	fbq('track', 'AddToCart');
Add to wishlist	fbq('track', 'AddToWishlist');
Initiate checkout	fbq('track', 'InitiateCheckout');
Add payment info	fbq('track', 'AddPaymentInfo');
Make purchase	fbq('track', 'Purchase', {value: '0.00', currency: 'USD'});
Lead	fbq('track', 'Lead');
Complete registration	fbq('track', 'CompleteRegistration');

May be this answer will help you:

http://forum.cs-cart.com/topic/43718-how-to-setup-conversion-value-for-facebook-pixel/

Thanks Ecom but I wanted to know the filenames for configuring all the above actions when triggered.

How to add the FB code to Add to cart event ?

Add to cart fbq('track', 'AddToCart');

Just need the file name

Try this:

design/themes/YOUR_THEME/templates/buttons/add_to_cart.tpl

Try this:

design/themes/YOUR_THEME/templates/buttons/add_to_cart.tpl

Shouldnt this be on a file where the event press code of Add to Cart button is written , since the tpl code will run everywhere the button is loaded on ui .

Not sure

Shouldnt this be on a file where the event press code of Add to Cart button is written , since the tpl code will run everywhere the button is loaded on ui .

Not sure

Actually I did not integrate Facebook Pixel and did not see their docs. I just provided you with the file where the Add to cart button is displayed

Hello,

We already integrated Facebook pixel for one of our clients. To add the "fbq('track', 'AddToCart');" tracker you need make changes in the design/themes/YOUR_THEME/templates/buttons/add_to_cart.tpl file.

Thank you.

Hello,

We already integrated Facebook pixel for one of our clients. To add the "fbq('track', 'AddToCart');" tracker you need make changes in the design/themes/YOUR_THEME/templates/buttons/add_to_cart.tpl file.

Thank you.

could you please let me know how this will get implemented since the fb code should be only be called when the Add to Cart button is pressed rather than on the page where the button is displayed. any pointers would be helpful. Thanks.

Try use below changes in the design/themes/YOUR_THEME/templates/buttons/add_to_cart.tpl file:
    {assign var="fp_code" value="fbq('track', 'AddToCart');"}

    {include file="buttons/button.tpl" but_id=$but_id but_text=$but_text|default:__("add_to_cart") but_name=$but_name but_onclick="`$fp_code` `$but_onclick`" but_href=$but_href but_target=$but_target but_role=$but_role|default:"text" but_meta="ty-btn__primary ty-btn__big ty-btn__add-to-cart cm-form-dialog-closer"}

instead:

        {include file="buttons/button.tpl" but_id=$but_id but_text=$but_text|default:__("add_to_cart") but_name=$but_name but_onclick=$but_onclick but_href=$but_href but_target=$but_target but_role=$but_role|default:"text" but_meta="ty-btn__primary ty-btn__big ty-btn__add-to-cart cm-form-dialog-closer"}

Please note: better to create separate module with override the "buttons:add_to_cart" hook.

Try use below changes in the design/themes/YOUR_THEME/templates/buttons/add_to_cart.tpl file:
    {assign var="fp_code" value="fbq('track', 'AddToCart');"}

    {include file="buttons/button.tpl" but_id=$but_id but_text=$but_text|default:__("add_to_cart") but_name=$but_name but_onclick="`$fp_code` `$but_onclick`" but_href=$but_href but_target=$but_target but_role=$but_role|default:"text" but_meta="ty-btn__primary ty-btn__big ty-btn__add-to-cart cm-form-dialog-closer"}

instead:

        {include file="buttons/button.tpl" but_id=$but_id but_text=$but_text|default:__("add_to_cart") but_name=$but_name but_onclick=$but_onclick but_href=$but_href but_target=$but_target but_role=$but_role|default:"text" but_meta="ty-btn__primary ty-btn__big ty-btn__add-to-cart cm-form-dialog-closer"}

Please note: better to create separate module with override the "buttons:add_to_cart" hook.

We are in MVE 4.2.4 is this the block you are talking about to change since there are lot many similar lines.

{hook name="buttons:add_to_cart"}
    {assign var="c_url" value=$config.current_url|escape:url}
    {if ($settings.General.allow_anonymous_shopping == "allow_shopping" || $auth.user_id) && $show_vs_icon_buttons}
        {if ($product.avail_since > $smarty.const.TIME)}
        {*Product coming soon with add to cart*}
            {assign var="date" value=$avail_date|date_format:$settings.Appearance.date_format}
            {assign var="vs_coming_soon" value=__("product_coming_soon_add", ["[avail_date]" => $date])}
            {include file="buttons/button.tpl" 
                but_text=$but_text|default:$vs_coming_soon
                but_id=$but_id 
                but_href=$but_href 
                but_role="vs_icon"
                but_target=$but_target 
                but_name=$but_name 
                but_onclick=$but_onclick 
                vs_icon="vs-icon-coming-soon"
                but_extra_class="vs-add-to-cart"}
        {else}
            {include file="buttons/button.tpl" 
                but_text=$but_text|default:__("add_to_cart") 
                but_id=$but_id 
                but_href=$but_href 
                but_role="vs_icon"
                but_target=$but_target 
                but_name=$but_name 
                but_onclick=$but_onclick 
                vs_icon="vs-icon-grid-add-to-cart"
                but_extra_class="vs-add-to-cart"}
        {/if}
{elseif $settings.General.allow_anonymous_shopping == "allow_shopping" || $auth.user_id}
    {if $details_page || $show_vs_atc}
        {include file="buttons/button.tpl" 
            but_id=$but_id 
            but_text=$but_text|default:__("add_to_cart") 
            but_name=$but_name 
            but_onclick=$but_onclick 
            but_href=$but_href 
            but_target=$but_target 
            but_role="vs_atc"}
    {else}
        {include file="buttons/button.tpl" but_id=$but_id but_text=$but_text|default:__("add_to_cart") but_name=$but_name but_onclick=$but_onclick but_href=$but_href but_target=$but_target but_role=$but_role|default:"text"}

    {/if}
{else}

    {if $runtime.controller == "auth" && $runtime.mode == "login_form"}
        {assign var="login_url" value=$config.current_url}
    {else}
        {assign var="login_url" value="auth.login_form?return_url=`$c_url`"}
    {/if}

    {include file="buttons/button.tpl" but_id=$but_id but_text=__("sign_in_to_buy") but_href=$login_url but_role=$but_role|default:"text" but_name=""}
    

{__("text_login_to_add_to_cart")}

{/if}

{/hook}

  {else}
            {include file="buttons/button.tpl" but_id=$but_id but_text=$but_text|default:__("add_to_cart") but_name=$but_name but_onclick=$but_onclick but_href=$but_href but_target=$but_target but_role=$but_role|default:"text"}

        {/if}
    {else}

Tried changing the above code as suggested by you but the event doesnt register in FB for Add to Cart , could you please help me on this.

i'm using CS-Cart 4.6 Ultimate

i have multiple stores how to configure each store separately?

i installed the pixel base code by adding it in the header section on the default layout page for each store and it worked fine.

so how can i install the event codes for..

Search

View Content

Add to Cart

Add to Wishlist

Initiate Checkout

Add Payment Info

Purchase

Lead

Complete Registration

please help

Thanks

i'm using CS-Cart 4.6 Ultimate
i have multiple stores how to configure each store separately?
i installed the pixel base code by adding it in the header section on the default layout page for each store and it worked fine.

so how can i install the event codes for..

It is not trivial task. Please pay attention to ready to use solutions on the marketplace

Or you may contact to any CS-Cart developer and ask them to solve these issues for some money.

Our team is also at your service

I understand it's an old thread, but hope my solution is helpful for someone who is searching for an answer.

You would want to put all the facebook pixel "fbq" code lines on the header of the default page. To accomplish this you would log on to the admin panel of your cs-cart; then go to layouts-> click the layout that is set as default-> click the cog (gear) icon on the layout's name. One the window that appears, scroll down to "Custom HTML code" and paste the pixel code provided by facebook. Make sure to click "Save" when you're done.