0

I use a cloaking plugin for my WooCommerce external link products. Because the external links are cloaked it shows the cloaking link in GA. Is there any possible way to show the original uncloaked link in GA even though it is being cloaked? Thanks

1 Answers1

1

You'd likely want to get the uncloaked link and load it to your dataLayer. You can then push it from the dataLayer to a custom dimension in your GA. A custom event, such as an external link click could include this custom dimension. This would provide you with the join between the outgoing click (the cloaked link) and the original link. This is easily doable with Google Tag Manager or a few lines of event code.

Sal
  • 472
  • 1
  • 5
  • 22
  • Thanks for the response. I will have 1000s of products and many will import and delete daily. How would I get the uncloaked link to load to dataLayer? Then how would I push it from dataLayer to a custom dimension in GA? I have Tag Manager set up with GA but only through watching a video. So not the best at this. – user2373595 Apr 16 '20 at 11:29
  • @user2373595, ask the cloaking plugin to expose the final URL to GTM in a dataLayer.push(), and get that value into the link Event tag for GA. GA is not magic, it collects the data that is made available to it... Is it REALLY the outgoing link that your are looking for ? What if you collect the product SKU, name...? – Open SEO Apr 19 '20 at 08:40
  • Hi, I am using the plugin WooComerce Cloak Affiliate Links. There are only 2 files for the plugin here [File1](https://filebin.net/tcrdpnhxstluqs23/woocommerce-cloak-affiliate-links.php?t=xgmkkat7) [File2](https://filebin.net/tcrdpnhxstluqs23/class-wccal-product-external.php?t=96m9hzia). Is it possible you might know what to put for the dataLayer.push() and where to insert it or what to alter? I am already collecting the Product Name and SKU. Really hoping I can get the original uncloaked outgoing link as well while staying cloaked. – user2373595 Apr 20 '20 at 14:51
  • The plugin support said this "Some products have a "direct_url" field which contains the final URL of the product. If you can push that into the datalayer object, you should be good to go." – user2373595 Apr 20 '20 at 15:04
  • Then he wrote this: If it's available it can be found in the $product array: `$product = dfrps_product($product_id); $direct_url = isset($product['direct_url']) ? $product['direct_url'] : '';` – user2373595 Apr 21 '20 at 17:18