Answered

Integration with Google Adwords/Analytics

Has anyone figured out how to successfully pass order information on to Google Adwords/Analytics? I'd like to pass on the order total to get an accurate dollar figure on my conversions.



thanks, Daniel
I've tried everything but can't get it to work. It's a huge pain because how am I suppose to know which paid advertising is working.
You could create custom confirmation pages for each product/memberships. With these pages, you could create a custom conversion code with correct values on in each.

Example with 3 product (A $10 B $20 C$30)

Confirmation page A:
Confirmation page B:
Confirmatino page C:

If you have subscription based prices, you could insert calculated lifetime value from the rerpoting suite as the value.

A more dynamic solution, that I haven't tested, could be to insert the smart tag [MM_Order_Data name='total'] inside the tracking code. Don't know if it would work, but worth a shot.
I am looking for a solution to this as well. Still haven't found anything.
You can pass Google eCommerce data doing something along these lines. This would get added to your theme's functions.php.

add_action( 'wp_footer', 'my_wp_footer' );
function my_wp_footer() {

global $post;

if ( isset($post) )
if ( $post->ID == XXXX ) { // put the id of your membermouse "thankyou/confirmation" page here instead of XXXX
echo '

';
}

}
Answer

Here's how I got the data to pass to GA.


The data layer I'm using looks like this and goes in the confirmation page as raw HTML. It is essentially what has already been posted. Note that according to Google SKU is required.


<script>

window.dataLayer = window.dataLayer || []

dataLayer.push({

   'transactionId': '[MM_Order_Data name="id"]',

   'transactionAffiliation': 'Yoganatomy.com',

   'transactionTotal': [MM_Order_Data name="total"],

   'transactionTax': 0.00,

   'transactionShipping': [MM_Order_Data name="shipping"],

   'transactionProducts': [{

       'sku': '[MM_Order_Data name='productId']',

       'name': '[MM_Order_Data name="productName"]',

       'category': '',

       'price': [MM_Order_Data name="subtotal"],

       'quantity': 1

   }]

});

</script>


I then created a google tag manager account.

I then used https://wordpress.org/plugins/duracelltomi-google-tag-manager/ to insert my tag manager id into the GTM container in the footer.

Create a container for www.yoganatomy.com and published.

Create A New Trigger

Name it what you want...

Choose Event > page view

Configure Trigger > DOM Ready

Fire On Page URL > Contains https://www.yourdomain.com/confirmation/


Create A New Tag

Name it what you want...

Choose Product > Google Analytics

Choose Tag Type > Universal Analytics

Configure Tag > UA tracking Code and then Track Type TRANSACTION

Fire On > Choose more and then select the trigger that you created


While logged into GTM and using chrome browser, it automatically displayed a tag manager panel at the bottom of the window.

I logged out of admin and used a test account and watched the tag fire after checkout. In about 5 minutes it showed up in my GA account as a transaction with all details.

I hope this helps someone else.

@David K


Hi,


Sir, I would require your help here implementing ecommerce with the help of GTM. What I need to know is could I just copy paste your data layer code mentioned with my domain name in it? Are there any changes that are to be made to your data layer except for the domain name? I'm a newbie and I need to pass those values in my Analytics account using GTM.

Sushrut,


As far as I know, the instructions above still work. I have made no change to my website and am receiving all data.


Just follow the instructions and DEFINITELY replace the domain name.

David K, Sir, thank you so much. I've implemented it the same way as mentioned in your comment. Just hoping it works and reports in GA.

Login or Signup to post a comment