Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento Onepage Success Conversion Tracking Design Pattern
    primarykey
    data
    text
    <p>My intent is to track conversions through multiple channels by inserting third party javascript (for example google analytics, optimizely, pricegrabber etc.) into the footer of onepage success . </p> <p>I've accomplished this by adding a block to the footer reference inside of the checkout success node within local.xml and everything works appropriately.</p> <p>My questions are more about efficiency and extensibility.</p> <p>It occurred to me that it would be better to combine all of the blocks into a single block reference and then use a various methods acting on a single call to the various related models to provide the data needed for insertion into the javascript for each of the conversion tracking scripts. </p> <p>Some examples of the common data that conversion tracking may rely on(pseudo): Order ID , Order Total, Order.LineItem.Name(foreach) and so on</p> <p>Currently for each of the scripts I've made a call to the appropriate model passing the customers last order id as the load value and the calling a get() assigning the return value to a variable and then iterating through the data to match the values with the expectations of the given third party service.</p> <p><strong>All of the data should be pulled once when checkout is complete each third party services may expect different data in different formats</strong></p> <p><strong>Here is an example of one of the conversion tracking template files which loads at the footer of checkout success.</strong></p> <pre><code>$order = Mage::getModel('sales/order')-&gt;loadByIncrementId(Mage::getSingleton('checkout/session')-&gt;getLastRealOrderId()); $amount = number_format($order-&gt;getGrandTotal(),2); $customer = Mage::helper('customer')-&gt;getCustomer()-&gt;getData(); ?&gt; &lt;script type="text/javascript"&gt; popup_email = '&lt;?php echo($customer['email']);?&gt;'; popup_order_number = '&lt;?php echo $this-&gt;getOrderId() ?&gt;'; &lt;/script&gt; &lt;!-- PriceGrabber Merchant Evaluation Code --&gt; &lt;script type="text/javascript" charset="UTF-8" src="https://www.pricegrabber.com/rating_merchrevpopjs.php?retid=&lt;something&gt;"&gt;&lt;/script&gt; &lt;noscript&gt;&lt;a href="http://www.pricegrabber.com/rating_merchrev.php?retid=&lt;something&gt;" target=_blank&gt; &lt;img src="https://images.pricegrabber.com/images/mr_noprize.jpg" border="0" width="272" height="238" alt="Merchant Evaluation"&gt;&lt;/a&gt;&lt;/noscript&gt; &lt;!-- End PriceGrabber Code --&gt; </code></pre> <p>Having just a single piece of code like this is not that big of a deal, but we are doing similar things with a number of different third party services.</p> <p>Pricegrabber is one of the simpler examples. A more sophisticated tracking service expects a comma separated list of all of the product names, ids, prices, categories , order id etc.</p> <p>I would like to make it all more manageable so my idea to do the following:</p> <ol> <li>combine all of the template files into a single file</li> <li>Develop a helper class or library to deliver the data to the conversion template</li> </ol> <p>Goals Include</p> <ol> <li>Extensibility</li> <li>Minimal Model Calls</li> <li>Minimal Method Calls</li> </ol> <p><strong>The Questions</strong> 1. Is a Mage helper the best route to take? 2. Is there any design pattern you may recommend for the "helper" class? 3. Why would this the design pattern you've chosen be best for this instance?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload