FROM CACHE - en_header

Tracking ROI/conversion using API

vishhnu_ZOHO
Shopify Partner
4 0 0

Ours is an Email marketing tool and we are planning to integrate with shopify. In this integration, a user can send campaign to all their customers about the products (in configured Shopify account) from our side and we need to show a detail purchase information of sent campaign.

When ever purchase happened through a campaign immediately we need to track the information. Is any API is there to track this type of information along with our parametes.

Replies 5 (5)
vishhnu_ZOHO
Shopify Partner
4 0 0

To the continuation of the above question, we thought by putting a piece tracking code inside "Additional content & scripts" section will solve, but this also causes problem . Below is the tracking code

  {% if landing_site_ref .indexOf('OURPARAMETER') > -1 %}

<img id="zimage"  height="1" width="1" src=""/>
<script>

 var src="OUR CALL BACK URL";
  src=src+"?orderId="+"{{ id }}"+"&landingSite="+encodeURIComponent("{{landing_site_ref}}");
    document.getElementById("zimage").setAttribute("src",src);
 </script>

{% endif %}

For each campaign we will append two IDs one is an email Id and other is contact id to the source parameter as.. http://MYSHOP.myshopify.com/products/myproducts?source=MYPARAMETER_EMAILID_CONTACTID When ever user checkout, we will receive a request to above defined call back url along with orderId and landingSite  parameters. Because of cookie landingSite parameter always return old value due to this, we are not able to get proper contact id value who checked out.  How to resolve this case, thanks for your valuable suggestions in advance.

 

 

 

 

 

  

 

 

 

 

 

  

Allan_Gourdie
Shopify Partner
20 0 1

You want to consider using custom cart attributes.  These are hidden fields within the cart which you can add by editing your cart.liquid template e.g.

<input id="attributes[email]" type="hidden" name="attributes[email]" value="" />

<input id="attributes[contact]" type="hidden" name="attributes[contact]" value="" />

You then need to create some javascript that sits on the page to look for empty custom cart attributes and populate them from your cookie values etc, but once populated they will be kept within your order.

On the "Additional content & scripts" area, you can then access each attribute like...

{{ attributes.email}} and {{ attributes.contact}}

vishhnu_ZOHO
Shopify Partner
4 0 0

HI Allan ,

        How to create hidden fields with in the cart dynamically ?

Allan_Gourdie
Shopify Partner
20 0 1

If you don't want to manually edit cart.liquid, you could write some javascript that looks for the presence of the cart object within the HTML and then insert a new hidden element within the form.

Something along the lines of... 

(function(){

  var cart = document.getElementById("cartform");

  if ((cart !== null) ...

})();

vishhnu_ZOHO
Shopify Partner
4 0 0

Hi Allan,

              This approach  is working  fine. Is any way is there to insert the below Tracking code  dynamically ... ie when ever a check-out is happen , our notification URL need to be invoke with  required parameters.

  code:

   <img id="zimage"  height="1" width="1" src=""/>

<script>
 var src="OUR CALL BACK URL";
  src=src+"?orderId="+"{{ id }}"+"&zc_eid="+encodeURIComponent("{{   attributes.email}}")+"&zc_cid="+encodeURIComponent("{{ attributes.contact}}");
  document.getElementById("zimage").setAttribute("src",src);
 </script>