# Shopify Integration for Initiate checkout Event

Follow these steps to add the Convertedin pixel checkout event&#x20;

<figure><img src="https://1119750375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7X1MfKrY7KCRp85qrV%2Fuploads%2FQAq3xW1FooJCtXEkhUGt%2Fimage.png?alt=media&#x26;token=0509bed7-1fcb-4210-b267-290dbd0c0741" alt=""><figcaption></figcaption></figure>

* first go to **Themes** on the **Online Store** tab on the sidebar

<figure><img src="https://1119750375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7X1MfKrY7KCRp85qrV%2Fuploads%2Fd1Ktyl3m4KU3AZ06mmQk%2Fimage.png?alt=media&#x26;token=aef0bccb-8633-4e75-b02f-1706ddebab76" alt=""><figcaption></figcaption></figure>

* then select the edit the theme.liquid file and the initialization code of the pixel

<figure><img src="https://1119750375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7X1MfKrY7KCRp85qrV%2Fuploads%2FZaaZ76vQkOtISGwLsm3e%2Fimage.png?alt=media&#x26;token=6fda0461-7c99-48c6-a7e6-3a7c14e1d09b" alt=""><figcaption></figcaption></figure>

* Add the InitiateCheckout Event on click at checkout button&#x20;
* You should add "your\_pixel\_id" with the pixel id in the setting tab in Convertedin dashboard

```javascript
{% if request.page_type == 'cart' %}
  <script>
 let interval = setInterval(()=>{
            if(typeof ciq == "function"){
                 ciq("init", "your_pixel_id"); // the PixelId provided in convertedin dashboard
  var checkoutElm = document.getElementsByName('checkout')[0];
  if (checkoutElm) {
  checkoutElm.onclick = function(event) {
    var cart = {{ cart | json }};
  var originalCartItems = cart.items || {};
  var requestedCartItems = [];
  
  originalCartItems.forEach(function(item, index){
    var addedToCartObj = {id: null,quantity: 0, name:""};
    if(item.hasOwnProperty("id")) addedToCartObj.id = item.id;
    if(item.hasOwnProperty("quantity")) addedToCartObj.quantity = item.quantity;
    if(item.hasOwnProperty("title")) addedToCartObj.name = item.title;

    requestedCartItems.push(addedToCartObj);
  });
    
     ciq("track", "InitiateCheckout", {
        content: requestedCartItems, 
        currency: Shopify?.currency?.active ?? "USD", 
        value: cart.total_price 
    });
  }
}
                clearInterval(interval)
            }
        }, 500)
</script>
{% endif %}
```
