My API Keys

Tracking Events

Capturing On-site events
On-site events will need to be pushed into the Google Tag Manager dataLayer in order to be tracked by theMarketer.

Keep in mind that in order for event tracking to function properly, Google Tag Manager needs to be installed on your website.

**Furthermore, in order for event-based events to be captured properly, you will first need to setup your product feed. **

Set email
The __sm__set_email event needs to be called each time a guest registers, logs in or fills in the email address in a form on the website (e.g. Contact or Newsletter Form

<script>
dataLayer.push({
    event: "__sm__set_email",
  	email_address: "[email protected]",
		phone: "+40700000000", //optional
    firstname: "John", //optional
    lastname: "Doe" //optional
});
</script>

View homepage
The __sm__view_homepage event needs to be called every time a user visits the homepage of your website

<script>
dataLayer.push({
    event: "__sm__view_homepage"
});
</script>

View category
The __sm_view_category event must be called when a visitor goes to a category page. In this case, the category page is the page that displays the category details and its list of subcategories or the page that lists the products of a certain category. The “category” parameter must include the full breadcrumb of the category.

<script>
dataLayer.push({
    event: "__sm__view_category",
    category: "Men|Shoes|Sneakers"
});
</script>

View brand
The __sm__view_brand event must be called every time a visitor lands on a producer/brand page. In this case, the brand page is the page where the brand details are listed, or the page that lists the products belonging to that particular brand.

<script>
dataLayer.push({
    event: "__sm__view_brand",
    name: "Nike"
});
</script>

View product
The __sm_view_product event must be called every time a visitor clicks on a product details page.

<script>
dataLayer.push({
    event: "__sm__view_product",
    product_id: 4421
});
</script>

Add to cart
The __sm__add_to_cart event must be called every time a product is added to cart.

If you redirect the user to another page (e.g. the checkout page) right after they added the product to cart, the add-to-cart function must be triggered in the callback of your add-to-cart function.

If add-to-cart is possible in other pages too, other than in the product details page, the event must be triggered in those pages as well.

Variation of a product is the product properties group the user must choose before being able to add a product to cart => color, size, capacity, etc. For example, an online fashion store can set a system based on color and size variations => "Y - 32" (yellow color and size 32), "R - XS" (red color and size XS), "M" (size M) etc.

<script>
dataLayer.push({  
    event: "__sm__add_to_cart",
    product_id: 4421,
    quantity: 1,
    variation: {
    id: 4422,
    sku: "ABC123-S"
    }
});
</script>

Remove from cart
The __sm_remove_from_cart event must be called every time a product is removed from cart.

<script>
dataLayer.push({  
    event: "__sm__remove_from_cart",
    product_id: 4421,
    quantity: 1,
    variation: {
        id: 4422,
        sku: "ABC123-S"
    }
});
</script>

Add to wishlist
The __sm__add_to_wishlist event must be called every time a product is added to the wishlist.

If you redirect the user to another page right after they added a product to the wishlist, the add-to-cart function must be triggered in the callback of your add-to-wishlist function.

If add-to-wishlist is possible in other pages too, other than in the product details page, the event must be triggered in those pages as well.

<script>
dataLayer.push({
    event: "__sm__add_to_wishlist",
        product_id: 4421,
        variation: {
            id: 4422,
            sku: "ABC123-S"
        }
});
</script>

Remove from wishlist
The __sm_remove_from_wishlist event must be called every time a product is removed from the wishlist.

<script>
dataLayer.push({  
    event: "__sm__remove_from_wishlist",
        product_id: 4421,
        quantity: 1,
        variation: {
            id: 4422,
            sku: "ABC123-S"
        }
});
</script>

Initiate checkout
The __sm__initiate_checkout event needs to be called every time a user goes to the checkout page. If your platform has the checkout process in the same page as the cart page, the function will need to be called when the user goes to the cart page.

<script>
dataLayer.push({
    event: "__sm__initiate_checkout"
});
</script>

Save order
The __sm__order event must be called whenever an order is successfully registered.

For any payment method, the function must be called on the Thank You page (the page where the user is informed the order was registered). If there is no Thank You page, the function must be called after the order is successfully stored in the database.

For example, for online payment method, the function must be called after the response from the payment processor is received and the answer is positive (not error or fail). In this case it means the order is successfully registered (was paid). The function must be called in the Thank You page, when all the order registration process is finalized.

<script>
dataLayer.push({
    event: "__sm__order",
    number: 1234, //or "text" "XYZ1234"
    email_address: "[email protected]",
    phone: "0700000000",
    firstname: "John",
    lastname: "Doe",
    city: "Bucharest",
    county: "Bucharest",
    address: "Customer billing address",
    discount_value: 10, // Final value of the discount, such as 10 EUR, without currency
    discount_code: "XYZA124", //If no discount code is used by the customer, set empty string
        shipping: 10,
        tax: 20, //final value of taxes (VAT), such as 20 EUR, without currency,
        total_value: 230,
        products: [
            {
                product_id: 4421,
                price: 100,
                quantity: 1,
                variation_sku: "ABC123-S"
            },
            {
                product_id: 4425,
                price: 80,
                quantity: 1,
                variation_sku: "ABC125-M"
            }
        ]
});
</script>

Search
The __sm__search event must be called each time the search functionality on your website is used.

<script>
dataLayer.push({
    event: "__sm__search",
    search_term: "sneakers"
});
</script>

Custom events
If you want to send a Custom event from your website, you will first need to create the event in theMarketer interface, in the Settings -> Technical integration section. The event name created will need to match the event which is sent from the website. Both the event and the email parameters are mandatory.

<script>
dataLayer.push({
    event: "__sm__event_identifier",
    email: "[email protected]",
    payload: "any type of custom information" 
});
</script>