google analytics tracking events from iframed page - events

I'm having this problem in tracking GA events from iFramed page.
It is tracking but it's clearly tracking wrongly.
Unique events data seems to be OK, Total events definitely not OK... It shows that on avg. one visit makes 80 events, which I know is not right.
I didn't put any flags into GA tracking code.
It's just simple one domain tracking code.
So, I put tracking code into of my page and this page is iFramed into another.
It's a simple interactive banner where Click events are tracked.
I'm guessing I'm missing something in GA tracking code to make it work properly.
Does anyone had this problem, what am I missing to get Events tracked properly?

Related

Event sourcing data flows for a simple web application

Read through a lot of the CQRS/DDD/ES blog posts, still unsure a simple blog engine would work.
In the case of publishing a post, for instance...
User clicks publish → PostPublished event added to Event Store → Triggers the Aggregate Objects (for instance, Archive and FrontPage) to be updated to reflect most recent event.
On the user side, I click the publish button and am redirected to the front page of my blog, where I expect to see the new post on the top. However, if the Event Store is behind (say by 1-2 seconds), my new post will not show up.
Is the answer to have a system that waits for all the Aggregates to be updated before returning the redirect to the user?
Your question is how to deal with eventual consistency, and there really isn't a fool proof one size fits all solution.
The best solution IMO would be to simply put a 'Post published, it will show up in a moment' notification up there. Some people will also do queries over and over until they get the recent change THEN display the front page. Which delays the front page for a second or two if the ES is behind.

Implement real-time updating notification feature

I'd like to implement some visual indicator of various sections for the items whose status is pending in my app similar to facebook's / google plus unread notification indicator...I have written an API to fetch the count to be displayed, but I am stuck at updating it everytime an item gets added or deleted, I could think of two approaches which I am not satisfied with, first one being making an API call related to the count whenever a POST or DELETE operation is performedSecond one being refreshing the page after some time span...
I think there should be much better way of doing this from server side, any suggestion or any gem to do so?
Even in gmail it is refreshed on client request. The server calculates the amount of new items, and the client initiates a request (probably with AJAX). This requires an almost negligible amount of data and process time, so probably you can get away with it. Various cache gems even can store the part of the page refreshed if no data changed since last request, which even solves the problem of calculating only when something changed.
UPDATE:
You can solve the problem basically two ways: server side push, and a client side query. The push is problematic, for various reasons, rarely used in web environment, at least as far as I know. Most of the pages (if not all) uses timed query to refresh such information. You can check it with the right tool, like firebug for firefox. You can see as individual requests initiated towards the server.
When you fire a request trough AJAX, the server replies you. Normally it generates a page fragment to replace the old content with the new, but some cache mechanism can intervene, and if nothing changed, you may get the previously stored cache fragment. See some tutorial here, for various gems, one of them may fit your needs.
If you would prefer a complete solution, check Faye (tutorial here). I haven't used it, but may worth a try, seems simple enough.

AdSense on history.pushState enabled page

First off, I know this has been discussed over and over again. But let's take this as a "late 2012 edition" since things tend to change rapidly on the internet.
I have this web page which is a "classical" web page with full page refreshes. Every internal click produces new content. We can show AdSense ads this way without a problem.
Now I started looking into "ajaxifying" (PJAX) the whole page for performance reasons (I've actually made a prototype version and it works superbly). The whole thing works only on browsers that support history.pushState, and whenever a user clicks on a internal link a AJAX request is triggered that fetches only the content part of the page (everything between the header and footer) and replaces old content with it.
The end result is, that the user is presented with a brand new page (including the changed URL and what not) and only the mechanism for delivering the page has changed (full reload vs. AJAX). As far as google (and older browsers) is concerned this is still a regular page with regular links (progressive enhancement and all that).
And yet there isn't a way to display AdSense, what with the document.write's and AdSense's TOS ruining the party.
My question: is there a Google approved (I'm not interested in hacks that will get us banned) way to display AdSense ads on a page like this (and I haven't found it). Or if there isn't, does Google have any plans on supporting this in the future (again, I haven't found anything related to this).
update
After some more digging around I came across Google DFP, which seems to support async loading of adds. But, I'm not sure I can load AdSense ads through it dynamically without breaking the TOS. I'm 100% sure I can load other ads this way, but not for AdSense. Could somebody clear this up for me?
According to this page loading Adsense ads through DFP you are subject to the both the DFP and Adsense terms. So I guess if you are following the current Adsense terms you are not allowed to do what you are talking about... at the same time Google provides a rather easy method to do exactly what you want to do with DFP...
Its still a grey area...

Google Analytics ecommerce only tracking Paypal

I'm having an issue with Google Analytics ecommerce tracking. I've found numerous posts about this, but none of the fixes seem to apply. We're on Magento 1.5.0.1, so all the GA code should be built in. We also installed the Fooman GA+ module, but that didn't help this issue. The tracking code IS showing up on the success page when viewing the page source, but it doesn't look right...no items listed. If I view the list of transactions in GA, it seems that they are all the Paypal transactions but credit card or money order transactions aren't coming through. We use Website Payments Pro for our Credit Card transactions, so ultimately it's all going through Paypal anyhow.
I did some digging around in the code and it seems that the "_getOrdersTrackingCode" function in Ga.php is where the problem lies. I added some logging...
$orderIds = $this->getOrderIds();
Mage::Log($orderIds);
...and found that the majority of the time, $orderIds is empty. Sometimes it isn't and that is when the tracking code works.
What's going on here? Anyone know?
I have fixed the problem. We use a 3rd party extension for checkout and it needed to be updated for 1.5.0.1 compatibility. The dispatcher of the *checkout_onepage_controller_success_action* event needs to send an array of the order ids as well. This wasn't necessary in 1.4.2.0. I updated the extension and it's working great now! I hope this helps anyone else with a similar issue.
Please note that this is an ORDER COMPLETE / SUCCESS event. You can't see the rendered code until you've completed a (test) transaction. On the order confirmation page, hit view source. In your <script /> tag's you'll see some new push code if all goes well.
Yes, Brian, your code definitely lead us in the right direction. We ended up turning the PayPal checkout to test mode = yes, debug mode = yes. We're on 1.4.2. and this worked fine. Respond to this if you need help. If I'm alive, I will try to get back to you.

Using Google Analytics with an Ajax webapp

So I've got an Ajax-based webapp. The homepage serves most - almost all - of the site's functionality. It's split into 3 columns, and the first two are loaded from the page's HTML. The third column is loaded dynamically based on what is selected in the second column.
Would tracking an Ajax-based app with Analytics be as easy as putting the tracking code at the bottom of the PHP file that returns the contents of the third column? This seems logical to me, but, I'm a bit of an Analytics newbie and am sure you guys have much better answers.
Jack
As far as I know, this is usually done by calling ga.js's tracking events in your Ajax code. Including the snippet <script> probably wouldn't work.
There used to be a number of reference pages on the Google Analytics docs ("How to track Ajax applications"), but they are all gone for some reason.
The info in this support thread looks good. This is the asynchronous way to track a page view:
_gaq.push(['_trackPageview', '/pagefilename1']);
there are more push() examples in the reference.

Resources