Jump to content

Google Analytics Conversion Tracking - Goals


Recommended Posts

We do need to find out a few things:

 

1) If we want to redirect to the invoice, is there a way to trigger a Google Analytics Goal?

2) Even with redirect off, my page flow never hits the step=complete URL. What are the other URLs that signify a completed (and paid/unpaid) order?

 

A quick primer from Matt would go a long way -- just adding the stuff to order-complete.tpl doesn't help us when google needs to know the URL that is displayed for that template. (and for PayPal, no redirect to invoice, it's not step=complete.)

Link to comment
Share on other sites

Hi

 

open order-complete.tpl

 

at the end place the following

 

{literal}

Google conversion code here

{/literal}

 

Thanks

 

Paul

 

The onepage (XML) versions does not use order-complete.tpl, it jumps from order-signup to viewinvoice and skipping order-complete.tpl.

Link to comment
Share on other sites

  • WHMCS CEO
The onepage (XML) versions does not use order-complete.tpl, it jumps from order-signup to viewinvoice and skipping order-complete.tpl.

It doesn't matter what order form template is used, if you have it set to, it will show the order complete page at the end of the process.

 

Matt

Link to comment
Share on other sites

  • 3 weeks later...
I don't have time to finish this tonight (or next week for that matter) but someone will be able to take this and run with it...

 

I'm also going to try to get the Ecommerce reporting working as well in Analytics. (http://www.google.com/support/googleanalytics/bin/answer.py?answer=55528&topic=11002)

 

The good news is it should be possible. The bad news is that (almost) none of the data Google needs/wants is available in the smarty variables in the step=checkout stage. (Which uses the order-complete.tpl file)

 

We do have access to the order number, and from there can use a pair of MySQL queries to get the data. We need to use the Smarty {php} function, and have alot of work to do...

 

First, here's the basic queries:

select o.ordernum as `order-id`, null as affiliation, i.total as total, i.tax as tax, 0 as shipping, c.city as city, c.state as `state/region`, c.country as country FROM tblorders o LEFT JOIN tblinvoices i ON o.invoiceid = i.id LEFT JOIN tblclients c ON o.userid = c.id;

select o.ordernum as `order-id`, null as `sku/code`, ii.description as `product name`, ii.type as category, ii.amount as price, 1 as quantity from tblorders o LEFT JOIN tblinvoiceitems ii ON o.invoiceid = ii.invoiceid;

 

The first gets the transaction information, the second the items on the invoice for the order. (The where clauses, and query alias cleanup are left as an exercise for the reader.)

 

In the smarty {php} block you need to get the order number by using the function get_template_vars ($varname). In this case "$ordernum = $this->get_template_vars('ordernumber');" should do the trick.

 

Once you have the data back form MySQL you need to push the data back into smarty. $this->assign($var, $val) will do that.

 

Now if you handle the Google form creation in the {php} tag, or push the raw MySQL return and use smarty to iterate, is up to you.

 

If anyone else has any better ideas, I'm all ears. :D

 

Brianr,

 

Have you succeeded to get this on line?

 

I need this to. I have successfully set goals tracking, but that if not the same thing as tracking e-commerce transactions.

 

I think that there can be easier solution.

 

Because my setting of WHMCS redirect user to paid invoice automatically after payment, this form:

 

<form style="display:none;" name="utmform">

<textarea id="utmtrans">UTM:T|[order-id]|[affiliation]|

[total]|[tax]| [shipping]|[city]|[state]|[country] UTM:I|[order-id]|[sku/code]|[productname]|[category]|[price]|

[quantity] </textarea>

</form>

 

can be added to invoice template instead - checkout tpl.

 

I'm wondering if someone has tried this because it takes 24 hours for Analytics engine to show results. So before I spend the night with this it would be good to know.

 

Thanks.

Link to comment
Share on other sites

I haven't done this (yet?) because I fear that should I elect to do that on the invoice page itself it could get multiple 'hits' and throw off Analytics. (If it uses the order-id as a dupe-prevention this might be moot -- donno.)

 

I really want to do it as part of goal-conversion (perhaps in addition, if, again, duping the data is not a concern), however, I still don't have goal conversion working properly. I haven't been able to get a straight answer regarding the correct URL to use, and I'm about ready to give up the project. :(

Link to comment
Share on other sites

I haven't been able to get a straight answer regarding the correct URL to use, and I'm about ready to give up the project. :(

 

Go to the templates directory and open the orderforms folder, then go into the appropriate folder (boxes, default, singlepage) and add your code to order-complete.tpl. Be sure to wrap the code in {literal}{/literal} tags.

Link to comment
Share on other sites

Matt told me yesterday that this is not possible, so I guess that it is time to abandon this quest.

 

Are you sure, because I have a mail in which has written that it should be in the last order step, which is never been shown.

 

There are also allot of people requesting him how it can be done.

 

The page that shows the invoice (before payment) would be the next best thing.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated