there is something wrong when pjax running with google analytics. #56
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
thank you for this great pjax.
but I may found a bug when it run with google analytics.
options.analytics()didn't have any param. soga("send", "pageview", {"page": options.url, "title": options.title})got an errorCannot read property 'url' of undefined.I fixed it by replaced with
ga("send", "pageview", {"page": location.pathname, "title": document.title}).@coolhihi hi can you tell us which version of pjax you are using?
@darylteo v0.1.4
I get it by
npm install pjax@coolhihi we are currently working on a new release 0.2.2. Perhaps when we do release it, you can test your stuff to see if this issue is still present?
@darylteo Thank you. I can only got 0.2.1 by npm. Is the master HEAD 0.2.2? Or which way I can get 0.2.2?
@coolhihi You will need master HEAD. 0.2.1 is broken and will not work.
@darylteo I found that google analytics was removed in new version. But that's okay, I will add it myself. thanks
Please PR =)@coolhihi actually I suspect that the reason why it was removed was because you can easily do this by just adding a listener to document (pjax:complete) then firing the appropriate GA event. This would be the most appropriate thing to do as we cannot assume everyone is using Google Analytics.
We should at least add doc for this, so I am reopening.
@MoOx @darylteo the HEAD version also have this bug. I had sent pull request. But I agree with darylteo the google analytics code is not necessary. Google may change the api in the future, and users can easily do this in
pjax:completeorpjax:success. So I suggest to remove the code about google analytics.I have this bug too. I solve this problem with custom analytics function like this:
Closed by #59