WordPress pluggin not working with multiple instances of shortcode on the page (Social Discount Press) - wordpress

The problem can be seen this page: http://ignitingthesixthsense.com/pre-launch-1
The issue is with the pluggin called Social Discount Press. The purpose of this pluggin is that it prompts the user to share your webpage via social media, and if they do so a link will then appear giving them access to restricted content.
There are actually 2 problems, but I am not sure if they stem from the same issue or not.
1) The first issue is that I have placed the social share buttons on the page twice using this shortcode:
[social_sharing_discount index="2"]
And the second instance of the share buttons (towards the bottom of the page) do not work properly. The Facebook and Twitter button activate the share box when clicked, but after sharing, the "instant access" button does not appear beneath the share button as it should. And the Google button does nothing at all when clicked. I have found that if I remove the 1st instance of the share buttons (at the top of the page), then the second instance of them starts working, so in other words it only seems to work properly if there is one instance on the page at a time.
2) The second and much much smaller issue, is that when the Google share button is clicked, the access button appears before the person actually shares.
And assistance with this would be greatly appreciated.

I have found that the main cause of the issue was due to the pluggin being built mainly on ID's which need to be unique across the page. And having multiple instances of the same ID was causing many errors.
The solution was to rewrite some of the php and js to use Classes instead of ID's. This allowed for two instances of the pluggin to work on the same page, thus solving problem number one.
The reason why the google one is so inaccurate is because the author simply opens up a popup to the google share page in a popup, this doesn't allow us to see the JS events such as when we share.
On the other hand because the twitter and facebook jssdk are loaded into the page, we know the exact moment when there has been either of those have been shared and thus accurately display the instant access button.
Due to this the author of the pluggin is just doing a best guess as to when the user is likely to have shared. It this case the author is guessing that when the javascript onunload event fires, that logically the user has shared on google. Now the onunload event can be fired in multiple ways, one is when the user closes the popup, i.e the best guess scenario as to if the user has shared. However the onunload event also fires when the form loses focus, a user naviagtes a way or a link is clicked.
Furthermore the onunload event is only properly supported in IE, FF and Safari, not Chrome and Opera. Which in the end gives it differeing behaviour in different browsers.
All of this can lead to unpredicatable behaviour, such as what you are noticing.
A better solution would be for google to have a jssdk for the the google plus share that let's us create a share box on the fly, however it's lacking that functionality as of now.

Related

Variables in Tag manager sometimes fires and sometimes not

I'm tagging a new website, and I'm running with some problems.
At first, i used the click URL to differentiate different buttons, but it only fires 1/5 times approx, some times more sometimes less. So the IT team gave the click elements specific values, but I'm still encountering with the same problem. Is it a gtm problem or a website issue? how could I fix it?.. ill leave two images attached one when it fires correctly and the other when it doesn't.
*here it's NOT working
here it is
That is completely dependent on how the website is built. If your IT team could add ID to the elements that you are interested in tracking that will populate the variable Click ID. That is usually best practice and helps you to uniquely identify each component, whether it is a button or a header.

Push Google Analytics Tracking Event on Section / Image View

I have section on our products pages towards the bottom that shows similar products. Is it possible to use event tracking to track when someone sees them? I am currently doing click tracking on them, but it would be nice to be able to track a percent of click through for different suggestion types and to know what percent of people scroll down enough to see them on smaller screen sizes.
You might be able to use something like this jQuery 'in view' plugin to fire an event when that element comes into view: http://remysharp.com/2009/01/26/element-in-view-event-plugin/
Then, when that happens, you could fire a GA event. Depending on your use-case (whether or not you want to fire more than one event if the user scrolls away again and then brings it back into view), you may want to only bind once.
This jQuery plugin:
https://github.com/robflaherty/jquery-scrolldepth
seems to be well maintained and documented. It will do more than the one Remy Sharp suggested on his blog post, which is kind of old-ish by now. It can track scrolling-depth and detect when elements come into view. Once you have both you can do what you want with events, so you can calculate CTR on visible elements/sections.
There is also a non-jQuery fork, which is not as updated but might serve just as well:
https://github.com/leighmcculloch/gascrolldepth.js

Why is search functionality not working on this page?

we deliver micro-site content for our client. Our content is injected into a wrapper that is supplied by another developer.
To deliver our content we host the wrapper as well as the content. The user can access this at
http://fundcentre.[redacted].ie/ (try a search for '[redacted]')
For the other content that is not ours, the other developer hosts a similar (though slightly different) wrapper and delivers the content. the user accesses this here:
http://www.[redacted].ie/ (try a search for '[redacted]')
The wrapper contains a search box, which does not work for us but it works for the other developer. I took a look at the network traffic with FireBug but it appears that when I do the search from the wrapper that we're hosting, I'm getting a "407 Proxy Access Denied" error. My guess is their proxy has a problem with the fact that the search is being conducted from a page hosted outside the scope of their proxy.
It was also suggested that there were javascript errors on the page that were preventing the search from executing but I can't see any. Also, I don't think I'd get as far as the proxy error if that was the case.
I don't really understand this stuff too well though, so could somebody with a bit more experience please take a look and maybe shed some light on this for me? Thanks.
The problem appears to be that the search box and the button next to it (the magnifying glass) are both causing the whole page form to submit after they try to set the page URL to the search URL. When you type into the search field and hit "Enter", the outer form that's wrapped around the entire page is submitted. When the magnifying glass is clicked, it tries to load the search results but because it's an image button the click also causes the outer form to be submitted.
I'm not exactly sure how best to fix it, partly because I think the entire page design should be thrown out. But if you're stuck with it, it might be possible to get it working by ditching that in-line Javascript on the button (since it's not working anyway) and then wrapping the search stuff with its own <form> directed to the search page. Having a <form> within a <form> is bad mojo but that's hard to avoid in a design that puts the whole page in a <form> to start with.
Alternatively, you could try handling keypress events on the search input to detect "Enter", and have that handler and the code on the button both return "false" to stop the outer form submission.
edit — as to why that works on the other site, well it appears to me that there the outer form really is the "search" functionality somehow, as they don't have the click handler on the search button at all, so all it'll do is submit the outer form anyway.
edit again — also, I never see that "proxy" issue. The search from your page works fine for me if I first fix the inline Javascript on the button so that it ends with ; return false. That actually may be all you need to do.
It could be a problem that your tags' action are pointing to different scripts. One is pointing to "Home.aspx" and the other to "/Default.aspx".
The two links are in different subdomains, so maybe you would like to change the action of the subdomain so it contains the full location of the action (ex. "http://www.newireland.ie/Default.aspx")

Making sure googlebot is not spamming my mailbox

I have got a website running with an option to report abuse of functionality. This is being done by clicking a link. After the link is clicked the webmaster will get a report of the location where the content is that was reported as abuse. I have added an rel="NOFOLLOW" to the href of the particular links but this is not helping. It seems that this tag is only being used to check wheter a page has to be ranked or not. How can i Exclude googlebot from clicking those abuse links?
This is what a link looks like:
Click me
The way I would go is have the report abuse email be behind a POST form of some kind. For example, a drop down box to select the issue or a text box to write in some comment about the abuse. Another method would be to style the form submit button so that it looked like a link and use that in place of your current link if you didn't want to have another step.
I'd do this in two parts:
By default, I'd make the link take you to a page where you report the abuse via a (very short, friendly) form, one where if you don't want to, you don't even have to choose anything, just click the Report button. Clicking the Report button (or a cancel link) takes you back where you were.
I'd include JavaScript that would test if the user has modern browser features (DOM node creation and such) and, if so, change the action of the link so that when they click it, the form appears right there (in a small overlay box) rather than taking you to a separate page. That makes for a less-intrusive user experience. Either way, though, the end result is a form being submitted rather than simply a link being followed.

Cross-Platform Browser Communication Between Page and IFRAME (Same Domain)

For a specialized purpose with Aweber regarding a newsletter subscription, I have a page loading a nested IFRAME inside, and both reside on the same domain. (Many other stackoverflow posts talk about different domains, but this question deals only with the same domain.) I need a cross-platform way (including browsers as old as the dawn of IE6) for the two to communicate.
For example, someone fills out name and email and clicks a checkbox, and the hidden IFRAME next to the checkbox sits in a setInterval() loop watching for that. When it receives notification, it grabs the name and email and does a form post.
I thought at first that I could just drop a cookie in the parent page, and then the IFRAME child could then sit in an interval watching for that cookie. But my tests show that this won't work. The cookie gets created -- but the IFRAME can't see it. So, I tried the meta-refresh technique in the IFRAME, and again it couldn't see that cookie for some reason.
The only solution I can come up with is that the parent page will take the checkbox click (we use jQuery) and do an AJAX data push to the server into a database. The IFRAME can then check on an interval back to the server via AJAX to see if the database value has changed, and react to it if so. But this seems like an over-engineered solution and I'm looking for an easier alternative that works cross-platform, even in earlier browsers from the timeframe of IE6 and forward.
It's much more simple: In the iframe, you can access the parent variable, which contains the parent window. So you can use parent.document to find the form, read the values, etc.

Resources