Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Help With Variables For Pinterest Code Rate Topic   - - - - -

 
  • rmsilver7
  • Junior Member
  • Members
  • Join Date: 30-Mar 10
  • 208 posts

Posted 19 October 2020 - 10:20 PM #1

Hi All- 

 

I am trying to get some pinterest tracking code setup and I need some help with some of the variables to put in, and how to put them in. CS-Cart v4.9.1

 

This code goes into the <head> of every page (I was planning on putting it in the Layouts so it's more easily editable, but when I try putting a variable in it's not translating so I am not sure if it's the location or what I am trying to use). What I need is in the red email address to fill in if the customer is logged into their account or once they enter in an email address at checkout. I tried $user_data.email but that didn't do anything except print that text out. I tried using {literal} around it but that trick didn't work either. 

 

I need what is for '<user_email_address>'

 

<!-- Pinterest Tag -->
<script>
!function(e){if(!window.pintrk){window.pintrk = function () {
window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var
  n=window.pintrk;n.queue=[],n.version="3.0";var
  t=document.createElement("script");t.async=!0,t.src=e;var
  r=document.getElementsByTagName("script")[0];
  r.parentNode.insertBefore(t,r)}}("https://s.pinimg.com/ct/core.js");
pintrk('load', '########', {em: '<user_email_address>'});
pintrk('page');
pintrk('track', 'pagevisit');
</script>


<noscript>
<img height="1" width="1" style="display:none;" alt=""
  src="https://ct.pinterest.com/v3/?event=init&tid=#######&pd[em]=<hashed_email_address>&noscript=1" />
</noscript>
<!-- end Pinterest Tag -->

And minimally, then I need the variables for these checkout actions too: 

<script>
pintrk('track', 'checkout', { 
   value: 10.00, 
   order_quantity: 2, 
   currency: 'USD', 
   product_ids: ['1414', '1415'] }
);
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&ed[value]=10.00&ed[order_quantity]=2&noscript=1" />
</noscript>

But would really love for it to output like this example: 

<script>
 pintrk('track', 'checkout', {
   value: 116,
   order_quantity: 2,
   currency: 'USD',
   line_items: [
     {
       product_name: 'Pillows (Set of 2)',
       product_id: '11',
       product_price: 48.00,
       product_quantity: 1
     },
     {
       product_name: 'Pillows, Large (Set of 2)',
       product_id: '15',
       product_price: 68.00,
       product_quantity: 1
     },
   ]
 });
</script>

Riika Magnus
Silver-Logic Web & Print Services
http://www.silver-logic.com
(503) 213-3551

I offer Website Design, Management, Hosting and Graphic Design services. I'm located in Portland, OR and have been using CS-Cart since 2009 and doing Website design since 2003. I would love to hear about your next project!

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21167 posts

Posted 20 October 2020 - 04:53 AM #2

Use Google Analytics module as example

 

common script in the header

 

design/themes/responsive/templates/addons/google_analytics/hooks/index/head_scripts.post.tpl

 

order complete script

 

design/themes/responsive/templates/addons/google_analytics/hooks/checkout/order_confirmation.post.tpl

 

As for email., what should displayed for anonymous customers?

 

Also please note that { and } symbols should not be located on one string. In this case you will receive smarty error


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • rmsilver7
  • Junior Member
  • Members
  • Join Date: 30-Mar 10
  • 208 posts

Posted 20 October 2020 - 07:30 AM #3

So these have to be placed in tpl files and can’t be put in the script area of each page layout?

I think it should just be blank if no email address is available to show.

Thank you for the help so far!!
Riika Magnus
Silver-Logic Web & Print Services
http://www.silver-logic.com
(503) 213-3551

I offer Website Design, Management, Hosting and Graphic Design services. I'm located in Portland, OR and have been using CS-Cart since 2009 and doing Website design since 2003. I would love to hear about your next project!

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21167 posts

Posted 20 October 2020 - 01:31 PM #4

So these have to be placed in tpl files and can’t be put in the script area of each page layout?

I think it should just be blank if no email address is available to show.

Thank you for the help so far!!

 

Yes, you cannot use smarty variables in layout fields


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • rmsilver7
  • Junior Member
  • Members
  • Join Date: 30-Mar 10
  • 208 posts

Posted 22 October 2020 - 07:59 PM #5

I just took a look at the order_confirmation.post.tpl file in the Google Analytics addon and I see alot of the variables used look like this with ga in front:  

 

{$ga_order_info.order_id}

 

Is it okay to use that when it's not inside the GA addon folder? 

 

Any tips for the email address on the main code? 


Riika Magnus
Silver-Logic Web & Print Services
http://www.silver-logic.com
(503) 213-3551

I offer Website Design, Management, Hosting and Graphic Design services. I'm located in Portland, OR and have been using CS-Cart since 2009 and doing Website design since 2003. I would love to hear about your next project!

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21167 posts

Posted 23 October 2020 - 04:59 AM #6

Try to use $order_info. E.g.

{$order_info.order_id}

As for email, try to use

{$user_info.email|default:''}

(!) Not tested


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)