Loading...

Adding Google Analytics to an iEBMS Web Page

Comments

5 comments

  • I'd be interested to know if anyone has attempted to add google analytics e-commerce tracking. I am currently testing using a custom EZWriter confirmation to achieve it, but would be keen to here any other ideas/experience.

  • Stephan Froden

    Hi Lee, which module and version of Ungerboeck are you using for your EZWriter confirmation?

    Within Registration in v19 of Ungerboeck, the confirmation tab has a few options that you may be able to use:

    If you tick the 'Enable Custom Section' option, you can enter information into the Caption area.  This Caption area can have HTML text entered into it, and you can use the Placeholders on the right to insert some dynamic values.  I have seen these Placeholders used within hidden input tags (eg. <input type="hidden" name="regOrderNumber" value="@Order" />).  Using some JavaScript within the iEBMS Presentation Structure of the page, these values can be retrieved, and passed through to the Google code.  The limitation to this approach is that you can only use the few limited Placeholder values that are provided, and these do not include the total registration order amout, or other information that you might want to submit to the Google Analytics E-Commerce tracking.

    Alternatively, you can use the 'Enable EZWriter Configuration' option as you mentioned.  This allows you to pull some extra data about the order out of the database, such as the items ordered, the total amount paid, etc.  The EZWriter could then output the entire Google Analytics JavaScript code which gets included in the confirmation.  I have not seen this implemented myself, so I am unable to provide you with a working example.

    One thing to remember is that this will also get emailed to the user upon a successful registration.  Email clients typically do not process JavaScript (and therefore Google Analytics code), but you want to be careful which code you output.

  • Hi Stephan, thanks for the quick response. I tested this in 19.6G in iEBMS registration fairly successfully. 

    You are quite right about the limitation of fields in the "custom section"- this could have been a nice easy way to achieve the desired result.

    Having to rewrite the entire confirmation page was tedious and as  you point out, the full HTML (including js) is sent via e-mail to the client- not ideal. It does make me wonder whether there could be a better approach to the "templating system" (maybe things are better in v20?).

    I encountered a problem with the EZWriter Format discarded/reformatting my HTML code so had to do it by hand in SQL (I will raise this as a bug).

    Here's an example to get you started- Header:

    <script type="text/javascript">

    ga('require', 'ecommerce', 'ecommerce.js');

    ga('ecommerce:addTransaction', {

    'id': '*ER100_ORD_NBR',

    'affiliation': '*EV200_EVT_DESC',

    'revenue': '*ER100_ORD_TOT',

    'shipping': '0',

    'tax': '*ER100_ORD_TAX'

    });

    </script>

    <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt">Order: *ER100_ORD_NBR</SPAN></DIV>

    <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt">Affil: *EV200_EVT_DESC</SPAN></DIV>

    <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt">Total: *ER100_ORD_TOT</SPAN></DIV>

    <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt">Shipping: 0</SPAN></DIV>

    <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt">Tax: *ER100_ORD_TAX</SPAN></DIV>

     Detail:

    <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt">

    <TABLE style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt" border=1 cellSpacing=0 cellPadding=0 cols=6>

    <TBODY vAlign=top>

    <TR>

    <script type="text/javascript">

    ga('ecommerce:addItem', {

    'id': '*ER101_ORD_NBR',

    'name': '*ER101_DESC',

    'sku': '*SKU',

    'category': '*ER101_NEW_RES_TYPE',

    'price': '*ER101_EXT_CHRG',

    'quantity': '*ER101_RES_QTY'

    });

    </script>

    <TD style="WORD-WRAP: break-word" id=0 width=121>*ER101_ORD_NBR</TD>

    <TD style="WORD-WRAP: break-word" id=1 width=121>*ER101_DESC</TD>

    <TD style="WORD-WRAP: break-word" id=2 width=121>*ER101_RES_CODE</TD>

    <TD style="WORD-WRAP: break-word" id=3 width=121>*ER101_NEW_RES_TYPE</TD>

    <TD style="WORD-WRAP: break-word" id=4 width=121>*ER101_EXT_CHRG</TD>

    <TD style="WORD-WRAP: break-word" id=5 width=121>*ER101_RES_QTY</TD></TR></TBODY></TABLE></SPAN></DIV>

    Summary:

    <script type="text/javascript">

    ga('ecommerce:send');

    </script>

    <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 8.25pt">Send</SPAN></DIV>

  • Stephan Froden

    In v19, when you click OK on the Data Format window, the HTML will get reinterpreted, and certain parts of your code will get changed and/or removed.  The Data Format is generally quite good with HTML elements such as TABLEs and DIVs, but tends to reinterpret elements that aren't actually 'visible'.  By this, I am referring to elements such as hidden INPUT fields, SCRIPT tags, STYLE tags, etc.

    As you mentioned, to avoid the 'reinterpretation' of the HTML in the Data Format, you can move the HTML into the Data Source itself and just output one field that contains the HTML. Within your Data Format simply include this one field (eg. *HTML).  If you want your HTML to include lower case characters, you will have to use the LOWER() function within your SQL commands.

  • Martin Wooding

    Has anyone done this with the v20 pages

Please sign in to leave a comment.