Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #315716

    Hi there,
    I have many portfolio items on my site, every one has a buynow button with a different target link. I want to track this buynow button clicks using Google Analytics. For that i have to insert “onclick=”ga(‘send’, ‘event’, ‘Buy Button’, ‘Resume’, ‘Resume Template Download’);” event inside anchor tag of buynow button.

    Button shortcode is : [av_button label='Buy Now' link='manually,https://guru99.dpdcart.com/cart/add?product_id=93092&method_id=97551' link_target='' color='theme-color' custom_bg='#444444' custom_font='#ffffff' size='small' position='left' icon_select='yes' icon='ue859' font='entypo-fontello']

    I have many portfolio items like this which contains Buy now button and want to track them all.

    I read following two support tickets but didn’t get any idea
    1. https://kriesi.at/support/topic/add-cross-domain-tracking-code/
    2. https://kriesi.at/support/topic/ga-event-tracking-a-portfolio-item-external-link/

    Link to my site : http://career.guru99.com/premium/templates/vip-resume-template/

    Any help appreciated.
    Regards

    #315947

    Hi kriru!

    Thank you for using Enfold.

    Please add a unique selector for every buy now avia button. Refer to this link how: http://kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/

    Let’s use “ga-buy” for example. Add this at the very bottom of functions.php to add the onclick attribute on the buy button with the “ga-buy” custom css class:

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){	
    	jQuery('.ga-buy a').attr('onclick', 'ga(\'send\', \'event\', \'Buy Button\', \'Resume\', \'Resume Template Download\')\;');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Cheers!
    Ismael

    #383109

    This is awesome. How would you track multiple events on the same page, with different labels? Let’s say 2 buttons(above and below fold) and 2-3 different text links? Thanks.

    #383588

    Hi!

    Add a unique class attribute on the buttons and text then modify the script above:

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){	
    	jQuery('.ga-buy-1 a').attr('onclick', 'ga(\'send\', \'event\', \'Buy Button\', \'Resume\', \'Resume Template Download\')\;');
            jQuery('.ga-buy-2 a').attr('onclick', 'ga(\'send\', \'event\', \'Buy Button\', \'Resume\', \'Resume Template Download\')\;');
            jQuery('.ga-buy-3 a').attr('onclick', 'ga(\'send\', \'event\', \'Buy Button\', \'Resume\', \'Resume Template Download\')\;');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Regards,
    Ismael

    #455205

    Here is a quick update, for those who might run into this in the future. This does work. However, if you have too many events(I had 42 – to track each individual element, such as buttons, images and text links, on 3 different pages) it might get your IP temporarily banned with your provider. When this happens to me, I get a “ERR_EMPTY_RESPONSE” message and I can’t access the site for 2-3 minutes. This makes it impossible to even edit a page. I read that it might be because I am with GoDaddy and they limit the number of post requests for security reasons.

    After turning off all the plugins and uploading a fresh copy of the theme, I started removing the snippets that I added to the theme files and this javascript (unfortunately) turned out to be what was causing the problem.

    Is it possible to do it differently, or do I just have to limit the number of events that I am tracking?

    #455248

    P.S.
    The I/O on my hosting account gets maxed out @ the highest resource level when I try to edit a page, while using the
    JS in functions.php.

    #455702

    Hi!

    Sorry for the late reply, I think tracking 42 events might be a bit high. Could you try to limit them a bit to see what amount works without causing any problems?

    Regards,
    Rikard

    #456200

    Thanks for your reply. Better late than never ;) it is very welcome.
    Something is blowing my I/O usage through the roof and it gets my IP address temporarily banned (1-2 minutes I get ERR_EMPTY_RESPONSE message) . I can’t do simple stuff such as edit a page, or even view it when this happens. The javascript and the events are just the cherry on top. It’s what maxes out the I/O on my hosting. I’ve tried to narrow it down, took down plugins and installed WordFence, but I can’t find a trend. My raw server logs show my IP address as the one generating a lot of requests.

    #456491

    Hey!

    Looks like this is a common issue with GoDaddy. I found a lot of inquiries regarding the issue but found no conclusive solution for it:

    https://wordpress.org/support/topic/err_empty_response
    https://wordpress.org/support/topic/error-code-err_empty_response-1
    https://wordpress.org/support/topic/err_empty_response?replies=18
    https://wordpress.org/support/topic/someone-please-help-err_empty_response

    You can see the Godaddy signature all over the place. Have you tried to contact your hosting provider?

    Best regards,
    Ismael

    #456666

    Hey Ismael,

    Yes, I have contacted Godaddy. They’re saying that something is heavily using the I/O resources and I have to figure out what that is, before the website will function properly. I have read that other people have issues with their IP getting temporarily blocked, because it makes too many requests and a solution would be contacting the provider and whitelisting the IP. I have told them so, but they pointed out that something or multiple somethings is/are generating a lot of traffic for my I/O to spike up like that. I have seen it myself, when I try to edit or save a page, my I/O jumps at 2 MB/s, which is the highest resource plan for hosting. So, they are saying that even if they whitelist my IP, it will automatically get banned again the next time when the disk usage spikes up.

    This only seems to happen when I edit/save a page. If I take down all the plugins, it does work, although there is no particular plugin that causes the problem.

    So, is there anything that can be done. And, this maybe a stupid question, but is there a plugin/way to slow down or change how the requests to the server are made when editing pages?

    Thanks,
    Silviu

    #456701

    P.S. I have also gone through the visitor logs. admin-ajax get called at least every 2 minutes, or even several times per minute, from my own address. The most frequent referrer is the url of one of my pages getting updated /wp-admin/post.php?post=307&action=edit ; user agent Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36 . Should I worry that this happens every 2 minutes, even at 1 am when I was peacefully sleeping?

    #456968

    Update: Godaddy moved me from CPanel to Managed WordPress Hosting because, after 2×2 hour phone calls they couldn’t tell what was happening. I will keep you posted if this solves the problem or not, for your future reference. Sorry about all the ruckus ;)

    #457071

    Hey!

    Honestly, I haven’t tried monitoring a WordPress installation server before so I’m not familiar on server activities and/or any server related troubleshooting procedure. Anyway, what is that page specifically? Please give us a temporary login details so that we can check it. It’s kinda weird that the ajax script is being executed even when you’re not editing or using the dashboard.

    I’m not sure if this is going to help but it can help speed up the dashboard, and maybe, with enough luck fix the issue at hand. Add this at the very bottom of wp-config.php file:

    define('CONCATENATE_SCRIPTS', false );
    

    Best regards,
    Ismael

    #457438

    Thanks, but so far the issue is solved and there is nothing to test. Now I am on a Managed WordPress environment, so I have much less control over the hosting account than with the CPanel.

    When I migrated my sites to the CPanel, last year, I had some include errors pop up and the sites were not displaying correctly. After doing some research, I found out that rolling back the Php version on the server will correct the issues and I asked GoDaddy to do just that. Now, that was one of the possible causes for all the issues that I had(Php version not being compatible with the security updates that GoDaddy implemented?).

    So, to sum it up – GoDaddy did some changes to their server security to guard against WordPress attacks. In some cases, those updates are causing that Err_Empty_Response Error and the offending IP is temporarily banned(for 2-3 minutes). Switching me to another type of hosting was their solution in my case. It’s working fine, so far.

    Thanks, I’ll keep you posted if I find out anything else.

    #458152

    Hey!

    Great, please let us know if you should need any more help on the topic.

    Cheers!
    Rikard

    #461633

    Here’s Godaddy’s response to my inquiries. They’ve been somewhat helpful after I pointed out that the error is due to their new security rules. I still get the error, but much less often after they’ve switched me to Managed WordPress hosting. I am posting this for anyone else that gets this error in the future. Moderator – maybe you should consider moving the Empty_Response posts to their own thread? Thanks.

    Dear Sir or Madam,

    I am a member of Hosting Support, contacting you in regard to “err_empty response” error message you’ve been encountering intermittently when working on your WordPress site.

    These errors on Linux Web Hosting accounts are due to MOD_SEC rules on our servers. The system relies on sets of scoring parameters to detect automation and spam. Repeated actions (i.e. excessive logins) from the exact same client to the same site will generally be the trigger. Over time though, this gets auto-unblocked.

    Here are a few other reasons as to why you may be encountering the Connection Reset error:

    1. You may have a malware/virus that is saved somewhere on the computer, possibly a tracking cookie.
    Solution: You may want to run a scanner to review your computer for any malware or virus.

    2. Local robots cache/cookie signatures can get their IP temporarily blacklisted.
    Solution: Please clear your browser’s cache & cookies or try a Private Browsing session.

    3. A cache/cookie from a previous login, causes the user will continue to try the login over and over.
    Solution: Please clear your browser’s cache & cookies or try a Private Browsing session.

    4. A saved cache/cookie data could attempt a POST to login over and over.
    Solution: Please clear your browser’s cache & cookies or try a Private Browsing session.

    5. Review scripts to ensure repeated rapid POST/GET requests are not being made.

    There are two types of requests – one is a POST request and the second is a GET request. A POST request is used to send your data through the internet and network sources to a visitor’s computer. During this process, a POST request may “post” information in multiple places, such as your WordPress administrative panel, the WordPress database, and your local computer’s cache. Each one of these posts equals one HTTP request. The following information further details POST requests:

    POST requests are never cached
    POST requests do not remain in the browser history
    POST requests cannot be bookmarked
    POST requests have no restrictions on data length

    The second HTTP request is a GET request, which is the request sent to your WordPress content from each visitor, search engine, or social media option such as Twitter, Facebook, or similar. If you have 10 visitors attempting to view the website via Facebook or directly entering the URL into a browser, you have 10 HTTP requests, which are operating at the same time as POST requests and all converging on the same WordPress content and database. Please note, GET requests are where you may be exceeding the HTTP requests and the following details the GET requests:

    GET requests can be cached
    GET requests remain in the browser history
    GET requests can be bookmarked
    GET requests should never be used when dealing with sensitive data
    GET requests have length restrictions
    GET requests should be used only to retrieve data

    The following table lists some other HTTP request methods:

    Method Description
    HEAD Same as GET but returns only HTTP headers and no document body
    PUT Uploads a representation of the specified URI
    DELETE Deletes the specified resource
    OPTIONS Returns the HTTP methods that the server supports
    CONNECT Converts the request connection to a transparent TCP/IP tunnel

    The following table compares the two HTTP methods: GET and POST.

    GET POST
    BACK button/Reload Harmless Data will be re-submitted (the browser should alert the user that the data are about to be re-submitted)
    Bookmarked Can be bookmarked Cannot be bookmarked
    Cached Can be cached Not cached
    Encoding type application/x-www-form-urlencoded application/x-www-form-urlencoded or multipart/form-data. Use multipart encoding for binary data
    History Parameters remain in browser history Parameters are not saved in browser history
    Restrictions on data length Yes, when sending data, the GET method adds the data to the URL; and the length of a URL is limited (maximum URL length is 2048 characters) No restrictions
    Restrictions on data type Only ASCII characters allowed No restrictions. Binary data is also allowed
    Security GET is less secure compared to POST because data sent is part of the URL

    Never use GET when sending passwords or other sensitive information! POST is a little safer than GET because the parameters are not stored in browser history or in web server logs
    Visibility Data is visible to everyone in the URL Data is not displayed in the URL

    Please let us know if we can assist you in any other way.

    #462006

    Hi!

    thanks for sharing this with us!

    Let us know in a new ticket in case you have some new issues or questions. We are happy to assist.

    Best regards,
    Andy

Viewing 17 posts - 1 through 17 (of 17 total)
  • You must be logged in to reply to this topic.