Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <script>
  2. require(['jquery'], function ($)
  3. {
  4. $(".tocart").click(function()
  5. {
  6. dataLayer.push({
  7. 'event': 'addToCart',
  8. 'ecommerce': {
  9. 'currencyCode': 'USD',
  10. 'add': {
  11. 'products': [{
  12. 'name': "<?php echo "$google_item_name $google_item_name_2 $google_item_name_3";?>", // Name or ID is required
  13. 'id': '<?php echo "$google_sku";?>', // Name or ID is required
  14. 'price': '<?php echo "$google_price";?>', // Insert product price
  15. 'brand': '<?php echo "google_site_owned_by_name";?>', // Insert product brand
  16. 'category': '<?php echo "$category_name";?>', // Insert product category
  17. 'quantity': '1', // Insert product quantity
  18. 'site': '<?php echo "$google_sitebeing_viewed";?>' // Insert site that product belongs to (e.g. site1, site2, site3)
  19. }]
  20. }
  21. }
  22. });
  23. });
  24.  
  25. });
  26. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement