How to implement google analytics event tracking in shopify?

How implement google analytics event tracking in shopify?

Hello Friends,

I hope you all are doing well.

I am here going to explains how to implement event tracking with analytics.js on your shopify website.

Generally we can implment google analytics event traking on our website in a easy way using jquery or js (Ref. https://developers.google.com/analytics/devguides/collection/analyticsjs/events).

If you are going to implement event tracking code on your shopify websites then you can’t add event traking in a normal way. For add to event traking code on shopify website, you will must have need to follow shopify inbuilt function ShopifyAnalytics.merchantGoogleAnalytics()

You have need to call event traking within shopify analytics function.

window.ShopifyAnalytics.merchantGoogleAnalytics = function() {
// tracking code will be add here
ga(‘send’, ‘event’, [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
}

Example : Add event traking for newsletter

Find newsletter.liquid files (Admin >> Theme >> Edit code >> Section ) and add given below code under {% if form.posted_successfully? %} conditon

/* implement google event traking code */
window.ShopifyAnalytics.merchantGoogleAnalytics = function() {
ga(‘send’, ‘event’, ‘Subscribe’, ‘click’, ‘subscribeforcode’, 1);
}

If you found this post helpful then please don’t forget to like our facebook page.

Enjoy Code!

Advertisements
Tagged with: , , , , ,
Posted in Shopify

Google Plus Remove Share Counts Options

Hello Friends,

I want let you know two years ago, Twitter had removed tweets counter and now Google plus 😦

This is very bad news for all customers who were using google plus share counter buttons to promote his site, his products, his articles…etc

Google Plus Official Announcement :

In a blog post published in the middle of June this year, John Nack announced that the Google+ button – the G+ button provided for blogs to share their +1 count – is changing.

“The G+1 button is shown billions of times per day on web pages around the world, so it’s important that it load as quickly and efficiently as possible. To make it easier for people to load and share the pages they’re interested in, we’ve created a simpler G+1 button sharing experience. Beginning in a few weeks, clicking the +1 button will open a streamlined new Google+ sharing dialog, and the G+1 button will no longer display a +1 count.”

So, a simpler share button means the Google +1 button, without any count attached to it.

 

Tagged with: , ,
Posted in Wordpress

Released new version 3.2 of wordpress plugin “Custom Share Buttons With Floating Sidebar” Addon

Dear Friends,

We have released new version 3.2 of our wordpress plugin “Custom Share Buttons With Floating Sidebar” Addon  with some extra features.

 Click here to view all features of addon OR view given below demo:

New Features :

  1. Added an option for choose to custom styles of floating sidebar as per your website design
  2. Added an option for define to floating sidebar position for every page separately
  3. Added an option for define to choose to show the social buttons before and after post content.
  4. Modified light box pop-up functionality and fixed some minor css issues.

Please don’t forget to give your valuable suggestions and feedback about our addon for make it more user friendly and much more popular compare to other social plugins.

Tagged with: , ,
Posted in Wordpress

How to update your wordpress site urls after move on other server?

Hello Friends!

I hope you all are enjoying my previous post https://raghunathgurjar.wordpress.com/2013/12/24/how-change-and-update-wordpress-urls-in-database-when-site-is-moved-to-new-host/ that i had posted it few year ago.

During setup of wordpress site from “Local Server” to “Live Server”, we always need to update the site & home url of the website as per new domain url. There are three way for update to the site url after move site on other server.

1.) You can directly run given below mysql query from phpmyadmin

/** update URL in options table **/
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
/** update URL in posts table **/
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
/** update URL in posts table **/
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
/** update URL in postmeta table **/
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

NOTE : Here we are using “wp_” as prefix of the tables, In your case, it might be different, so please don’t forget to update it’s value as per your database before run mysql query. You can find out the prefix of the table from wp-config.php file, just find “$table_prefix” variable in your website config.php file.

 

2.) You can define site and home url directly through the wp-config.php file , just add given below code into wp-config.php file

/** Define site URL
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

3.)You can also update site and home url through theme function.php file, just add given below two lines to the file, immediately after the initial “<?php” line.

update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );

 

I want suggest you to choose first way becuase second and third one have a drawback. Drawback is that it will update permalink urls only not images/links that have saved into database.

Tagged with: , ,
Posted in Wordpress

How to create same height HTML block using jQuery?

Hi Friends,

If you are facing HTML block height related responsive issue then you can use given below HTML to make all boxes in a same height

CSS

<style type="text/stylesheet">
div.box {
float: left;
width: 23%;
background: #ccc;
margin: 10px 1%;
padding: 1%;
}

@media all and (max-width: 900px) {
div.box {
width: 48%
}
</style>

JS

equalheight = function(container){
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$(container).each(function() {

$el = $(this);
$($el).height('auto')
topPostion = $el.position().top;

if (currentRowStart != topPostion) {
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
rowDivs.length = 0;
currentRowStart = topPostion;
currentTallest = $el.height();
rowDivs.push($el);
} else {
rowDivs.push($el);
currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
}
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
});
}

$(document).ready(function() {
// here #mainsec is the main parent div and box it's child div
equalheight('#mainsec .box');
});

$(window).on('resize',function(){
// here #mainsec is the main parent div and box it's child div
equalheight('#mainsec .box');
});

HTML

You can also watch my video for live demo and share with your friends.

Enjoy Code!!

Tagged with: , , ,
Posted in HTML, JQuery, Wordpress

How to remove comment-reply.js from your wordpress site ?

Hello Friends,

I hope you all are doing well!!

If you want to remove “comment-reply.js” file and reduce to number of HTTP request from your wordpress website then don’t worry,  I am going to share my knowledge, so you can do it easily even if you have any technical knowledge or not.

Just add given below code into your function.php file and refresh the page.

// Remove comment-reply.min.js from footer
function remove_comment_reply_js(){
wp_deregister_script( ‘comment-reply’ );
}
add_action(‘init’,’remove_comment_reply_js’);

It will Show only on blog post

// Remove comment-reply.min.js from footer
function remove_comment_reply_js(){

if(is_singular(‘post’)){

// no action

}else{
wp_deregister_script( ‘comment-reply’ );

}
}
add_action(‘init’,’remove_comment_reply_js’);

You can also watch my video for live demo

Enjoy Code

Tagged with: , , , ,
Posted in Wordpress

How change “no available shipping methods” message in woocommerce : WordPress

Hello Friends,

I hope you are you doing well.

I am here again going to share some useful knowledge regarding to woocommerce shipping information.

If you want to change “No Shipping Method Available” then you will need no need to edit in plugin core files. Just add given below code into your theme function files and set your own custom message that you want to publish on shipping section.

 

add_filter( 'woocommerce_no_shipping_available_html', 'my_custom_no_shipping_message' );

add_filter( 'woocommerce_no_shipping_available_html', 'my_custom_no_shipping_message' );

add_filter( 'woocommerce_cart_no_shipping_available_html', 'my_custom_no_shipping_message' );

function my_custom_no_shipping_message( $message )
{
return __( 'A minimum of 6 products is required. Add more products to complete your purchase' );
}

 

Enjoy Code!

Tagged with: ,
Posted in woocommerce, Wordpress
%d bloggers like this: