Quick Questions: Customisation & Analytics

12 years 5 months ago - 12 years 5 months ago #182546 by ala7lam
Thanks for the information Beat. After some reading online, I've created this for my registration process. I hope it works without problems.

I have just posted this here incase someone needed some ideas from this. It is not tested yet, I will test it and see if it is working.

I am going to add this to an external JS file and load into my header. Having it in one file is much easier to edit.

The first function is used to automatically track all external links on my website. To be able to track them, a rel="external" has to be part of the link tag.
// Start when Document Loads
$(document).ready(function(){
// Tracking External Links by adding .external class to outgoing links
$("a[rel*='external']").click(function(){
_gaq.push(['_trackPageview', '/outgoing/'+ $(this).attr('href')]);
});
// Tracking CTA to Register on 2 different positions as a page view
$('a#gae-reg-ini-cta-red').click(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/CTA-initiate']);
});
$('ul.menutop li.170 a').click(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/CTA-initiate']);
});
// Those are tracked as Page Views to be able to use them on goals
// Loaded Registration Form
$('div#registrationTable div#cbfr_intro').load(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/Registration-Form']);
});
// Submitted Registration Form
$('div#registrationTable input.registerButton').click(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/Registration-Form-Submit']);
});
// Invoice/Basket Loaded
$('div.cbpayBasketView div.cbregBasket').load(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/Invoice-Basket-Loaded']);
});
// Moved to Add Payment Address details page (Optional Step?)
$('div.cbformdiv fieldset#cbfr_invoicing_address').load(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/Invoice-Address-Edit']);
});
// Confirmed Order
$('div.cbpayBasketView div#cbpaidButtyellowpay input').click(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/Registration-Completed']);
});
$('div.cbpayBasketView div#cbpaidButtyellowpay input').click(function(){
_gaq.push(['_trackEvent', 'Registration', 'Completed Registration', 'Completed the Registration process', opt_value]);
});
// Cancelled Order
$('div.cbpayChoices a').click(function(){
_gaq.push(['_trackPageview', '/GAT/Registration/Registration-Cancelled']);
});
// Ending Below
});

If one spots any thing wrong, by all means, please let me know :).

I have used the GAE/Registration/Registration-Completed for the label because I think it can be used for goals if I wasn't mistaken (Haven't done this for quite sometime).

CB 1.7.1
CBSubs

Please Log in to join the conversation.

12 years 5 months ago #182728 by beat
I didn't review in details, but it's exactly the kind of events that I was describing.

Thanks for sharing it here, and please let us know how it worked for you :)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

12 years 5 months ago #182730 by ala7lam
You are welcome beat. Haven't finished testing it so I can't say for sure yet if its functioning as it should be.

If there are any changed needed I will update the code.

Thanks!

CB 1.7.1
CBSubs

Please Log in to join the conversation.

12 years 5 months ago #183887 by ala7lam
Hi again,

For some reason, the page views are not being registered in Google Analytics. Can someone please give the code a quick look and tell me if I was using the correct JQuuery Selection method and if there are any issues with the code?

Thanks!

CB 1.7.1
CBSubs

Please Log in to join the conversation.

12 years 5 months ago #183890 by krileon
All of your .load won't work. It's meant for loading of images or loading of iframes for example. You really need to be using an appropriate combination of PHP and JS. Being purely based off JS and selectors is a vulnerability. Using the Google library in combination of a CB plugin and utilizing CB triggers is your most safe approach. For example there's an after registration display trigger, an after registration trigger, etc.. and at that point is when you'd execute your tracking code, which would immediately go away instead of sitting in the DOM waiting on a handler to fire. Please see tutorials within my signature for trigger usage information and a working example.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 5 months ago #183904 by ala7lam
Thanks for your response. I am not that into programming so I went to check your tutorial on event triggers but I couldn't fine the example. Is it on a different topic?

Any ideas if what I am trying to do has been done for CBSubs before? I think it is important to be able to show the visualisation of the funnel.

Thanks!

CB 1.7.1
CBSubs

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.255 seconds

Facebook Twitter LinkedIn