Skip to content

Instantly share code, notes, and snippets.

View marketingclouded's full-sized avatar

Ed Gray marketingclouded

View GitHub Profile
<script>
_etmc.push(["setOrgId", "MID"]);
_etmc.push(["trackPageView", { "category" : "{{ collection.title }}" }]);
</script>
<script>
_etmc.push(["setOrgId", "MID"]);
_etmc.push(["trackPageView", { "search" : "{{ search.terms }}" }]);
</script>
<script type="text/javascript" src="//MID.collect.igodigital.com/collect.js"></script>
{% if first_time_accessed %}
<script>
_etmc.push(["setOrgId", "MID"]);
_etmc.push(["trackConversion", { "cart": [
{%- for line_item in order.line_items -%}{"item" : "{{ line_item.product.handle }}", "quantity": "{{ line_item.quantity }}", "price" : "{{ line_item.product.price | money_without_currency}}", "unique_id" : "{{ line_item.sku }}" },{% endfor %}
]}]);
</script>
{% endif %}
<script>
_etmc.push(["setOrgId", "MID"]);
_etmc.push(["trackCart", { "cart": [
{%- for item in cart.items -%}
{"item" : "{{ item.product.handle }}", "quantity": "{{ item.quantity }}", "price" : "{{ item.product.price | money_without_currency }}", "unique_id" : "{{ item.sku }}" },
{% endfor %}]
}]);
</script>
{% if cart.item_count == 0 %}
<script>
<script type="text/javascript">
var _etmc = _etmc || [];
document.querySelector('.product-form__cart-submit').addEventListener('click',function () {
_etmc.push(["setOrgId", "MID"]);
_etmc.push(["trackCart", { "cart": [
{"item" : "{{ product.handle }}", "quantity": "{{ 1 }}", "price" : "{{ product.price | money_without_currency }}", "unique_id" : "{{ product.selected_or_first_available_variant.sku }}" },
{%- for item in cart.items -%}
{"item" : "{{ item.product.handle }}", "quantity": "{{ item.quantity }}", "price" : "{{ item.product.price | money_without_currency }}", "unique_id" : "{{ item.sku }}" },
{% endfor %}
]}]);
{% for variant in product.variants %}
_etmc.push(["updateItem",
{
"item": "{{ product.handle }}",
"unique_id": "{{ variant.sku }}",
"name": "{{ product.title }}",
"url": "https://yourstoredomain{{ product.url }}?variant={{ variant.id }}",
"item_type": "product",
"available": "{% if product.available == true %}Y{% else %}N{% endif %}",
"image_url": "https:{{ product | img_url: "medium" }}",
<script>
_etmc.push(["setOrgId", "MID"]);
_etmc.push(["trackPageView", { "item" : "{{ product.handle }}" }]);
</script>
<script>
window.addEventListener('load', function () {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const uniqueid = urlParams.get('sfmc_sub');
_etmc.push(["setOrgId", "MID"]);
_etmc.push(["setUserInfo", {"email": uniqueid }]);
_etmc.push(["trackPageView"]);
}, false);
</script>
<script type="text/javascript" src="//MID.collect.igodigital.com/collect.js"></script>
<h2 style="text-align:center;font-family: Roboto, sans-serif;">
Weekly Send Log
</h2>
<table style="width:100%;border:2px solid black;font-family: Roboto,sans-serif;">
<tr><th style="background-color:#031445;color:#fff;padding:10px;border-bottom:1px solid black;text-align:center;">Week Starting</th>
<th style="background-color:#031445;color:#fff;padding:10px;border-bottom:1px solid black;text-align:center;">Sent</th>
<th style="background-color:#031445;color:#fff;padding:10px;border-bottom:1px solid black;text-align:center;">Opens</th>
<th style="background-color:#031445;color:#fff;padding:10px;border-bottom:1px solid black;text-align:center;">Clicks</th>
<th style="background-color:#031445;color:#fff;padding:10px;border-bottom:1px solid black;text-align:center;">Bounces</th>
</tr>