Announcement

Collapse
No announcement yet.

Where do you place the tracking pixel script for Shareasale on the Invoice template?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Where do you place the tracking pixel script for Shareasale on the Invoice template?

    I have developed the script I'm going to use for the advanced pixel for Shareasale. What template and where do I put the finished script? Here is an excerpt

    <img id="_SHRSL_img_1" src="https://shareasale.com/sale.cfm?amount=&mvt:global:orderSubtotal;&trackin g=&mvt:order:id;&transtype=sale&merchantID=12345&s kulist=&mvt:global:productSKUs;&quantitylist=&mvt: global:productQuantities;&pricelist=&mvt:global:pr oductPrices&currency=USD&couponcode=&mvt:coupon:co de;" width="1" height="1">
    <script defer async type="text/javascript" src="https://shareasale-analytics.com/j.js"></script>

    Thank you.

    #2
    Typically, you want these right before the </body> tag on the page in question. If, for some reason that tag isn't there on the invoice screen (i.e., its in the global footer) you can place it at the end of the INVC page or use this right before the location of the </body> tag.

    [code]
    <mvt:if expr="g.screen EQ 'INVC'">
    pixal code goes here
    </mvt:if>
    [/code ]
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Thank you Bruce. On the page I see:

      <mvt:item name="body">

      content

      </mvt:item>

      Would I put the code just after this? Here it is. Do include the tag? Also, I've been reading the forums to produce the code for ShareaSale's advanced pixel. Let me know if the following would work to iterate the sale by sku, quantity and price (comma separated). Many thanks for your help.

      [code]
      <mvt:if expr="g.screen EQ 'INVC'">

      <mvt:assign name="g.orderSubtotal" value="0" />
      <mvt:foreach iterator="item" array="basket:items">
      <mvt:assign name="g.orderSubtotal" value="g.orderSubtotal + l.settings:item:price" />

      <mvt:if expr="g.productSKUs">
      <mvt:assign name="g.productSKUs" value="g.productSKUs $ l.settings:item:code $ ','" />
      <mvt:else>
      <mvt:assign name="g.productSKUs" value="l.settings:item:code $ ','" />
      </mvt:if>

      <mvt:if expr="g.productQuantities">
      <mvt:assign name="g.productQuantities" value="g.productQuantities $ l.settings:item:quantity $ ','" />
      <mvt:else>
      <mvt:assign name="g.productQuantities" value="l.settings:item:code $ ','" />
      </mvt:if>

      <mvt:if expr="g.productPrices">
      <mvt:assign name="g.productPrices" value="g.productPrices $ l.settings:item:price $ ','" />
      <mvt:else>
      <mvt:assign name="g.productPrices" value="l.settings:item:code $ ','" />
      </mvt:if>


      <img id="_SHRSL_img_1" src="https://shareasale.com/sale.cfm?amount=&mvt:global:orderSubtotal;&trackin g=&mvt:order:id;&transtype=sale&merchantID=12345& s kulist=&mvt:global:productSKUs;&quantitylist=&mvt: global:productQuantities;&pricelist=&mvt:global:pr oductPrices&currency=USD&couponcode=&mvt:coupon:co de;" width="1" height="1">
      <script defer async type="text/javascript" src="https://shareasale-analytics.com/j.js"></script>


      </mvt:if>
      [/code ]
      Last edited by Rick Wilson; 09-12-18, 04:49 PM.

      Comment


        #4
        Assuming this code will only be used for INVC page, you can add this piece directly into the INVC page. You can add this piece of code into the page-specific footer in there, thus removing the need for IF block to check if you are on invoice page.
        Rajnish Sinha
        ---------------------
        https://twitter.com/rajnishsi

        Comment


          #5
          Thank you Rajnish. When I put it directly into the page, we are getting the following error

          Error compiling template: At 109:7-109:10 - syntax error, unexpected ITEM, expecting FOREACH

          So placement is not the issue, just the script. Any obvious things in the code that are incorrect. I have been following this thread for a guide.
          https://www.miva.com/forums/forum/de...tracking-pixel

          Again, much appreciated.
          Last edited by Rick Wilson; 09-13-18, 06:35 AM.

          Comment


            #6
            FOREACH that you started in line 3 of your code was never closed anywhere ! I missed this part previously. You'll need to add the ENDFOREACH tag just before your img tag. That is why you are getting this error.
            Rajnish Sinha
            ---------------------
            https://twitter.com/rajnishsi

            Comment

            Working...
            X