<commit_before><!-- Google Tag Manager -->
<% @gtm = get_google_tag_manager_id %>
<noscript>
  <iframe src="//www.googletagmanager.com/ns.html?id=<%= @gtm.gtm_id %>"
          height="0" width="0" style="display:none;visibility:hidden">
  </iframe>
</noscript>
<script>
    google_tag_manager = '<%= @gtm.gtm_id %>'
    if ( google_tag_manager.length > 0 ){
        dataLayer = [];
        (function (w, d, s, l, i) {
            w[l] = w[l] || [];
            w[l].push({
                'gtm.start': new Date().getTime(), event: 'gtm.js'
            });
            var f = d.getElementsByTagName(s)[0],
                    j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
            j.async = true;
            j.src =
                    '//www.googletagmanager.com/gtm.js?id=' + i + dl;
            f.parentNode.insertBefore(j, f);
        })(window, document, 'script', 'dataLayer', '<%= @gtm.gtm_id %>');
    }
</script>
<!-- End Google Tag Manager -->

<%= javascript_tag do %>
    <% google_tag_manager = @gtm.gtm_id%>
    <% if google_tag_manager.present? %>
        <% if @order.present? and @order.email.present? %>
            dataLayer.push({'transactionEmail': '<%= @order.email %>'});
        <% end %>
        <% if @order.present? and @order.user.present? %>
            dataLayer.push({'userid': '<%= @order.user.id %>'});
        <% end %>

        <% if flash[:commerce_tracking] and @order.present? %>

            dataLayer.push({
            'transactionId': '<%= @order.number %>',
            'transactionAffiliation': 'Yourcompanyname',
            'transactionTotal': <%= @order.total %>,
            'transactionTax': <%= @order.adjustments.tax.sum(:amount) %>,
            'transactionShipping': <%= @order.adjustments.shipping.sum(:amount) %>,
            'transactionCity': '<%= @order.bill_address.city %>',
            'transactionState': '<%= @order.bill_address.state_text %>',
            'transactionZip': '<%= @order.bill_address.zipcode %>',
            'transactionEmail': '<%= @order.email %>',
            'transactionProducts': [
            <%=raw @order.line_items.map { |line_item| "{ 'sku': '#{h line_item.variant.sku}',
                                                          'name': '#{h line_item.variant.product.name}',
                                                          'category': '',
                                                          'price': #{h line_item.price},
                                                          'quantity': #{h line_item.quantity}}" } .join(",") %>
            ]
            });
<commit_msg>bug corrected on views google_tag_manager<commit_after><!-- Google Tag Manager -->
<% @gtm = get_google_tag_manager_id %>
<noscript>
  <iframe src="//www.googletagmanager.com/ns.html?id=<%= @gtm.present? ? @gtm.gtm_id : '' %>"
          height="0" width="0" style="display:none;visibility:hidden">
  </iframe>
</noscript>
<script>
    google_tag_manager = '<%= @gtm.present? ? @gtm.gtm_id : '' %>'
    if ( google_tag_manager.length > 0 ){
        dataLayer = [];
        (function (w, d, s, l, i) {
            w[l] = w[l] || [];
            w[l].push({
                'gtm.start': new Date().getTime(), event: 'gtm.js'
            });
            var f = d.getElementsByTagName(s)[0],
                    j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
            j.async = true;
            j.src =
                    '//www.googletagmanager.com/gtm.js?id=' + i + dl;
            f.parentNode.insertBefore(j, f);
        })(window, document, 'script', 'dataLayer', '<%= @gtm.present? ? @gtm.gtm_id : '' %>');
    }
</script>
<!-- End Google Tag Manager -->

<%= javascript_tag do %>
    <% if @gtm.present? %>
        <% if @order.present? and @order.email.present? %>
            dataLayer.push({'transactionEmail': '<%= @order.email %>'});
        <% end %>
        <% if @order.present? and @order.user.present? %>
            dataLayer.push({'userid': '<%= @order.user.id %>'});
        <% end %>

        <% if flash[:commerce_tracking] and @order.present? %>

            dataLayer.push({
            'transactionId': '<%= @order.number %>',
            'transactionAffiliation': 'Yourcompanyname',
            'transactionTotal': <%= @order.total %>,
            'transactionTax': <%= @order.adjustments.tax.sum(:amount) %>,
            'transactionShipping': <%= @order.adjustments.shipping.sum(:amount) %>,
            'transactionCity': '<%= @order.bill_address.city %>',
            'transactionState': '<%= @order.bill_address.state_text %>',
            'transactionZip': '<%= @order.bill_address.zipcode %>',
            'transactionEmail': '<%= @order.email %>',
            'transactionProducts': [
            <%=raw @order.line_items.map { |line_item| "{ 'sku': '#{h line_item.variant.sku}',
                                                          'name': '#{h line_item.variant.product.name}',
                                                          'category': '',
                                                          'price': #{h line_item.price},
                                                          'quantity': #{h line_item.quantity}}" } .join(",") %>
            ]
            });

{'fraction_non_alphanumeric': 0.18955991617450943, 'fraction_numerical': 0.0015240998285387694, 'mean_word_length': 1.7588018917498687, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 66, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4621263', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1542, 'n_words': 255}