Passing Google Analytics Variables Through Javascript?
-
Alright so here's my situation and hopefully someone can help...
I want to be able to pass Google Analytics variables onto my affiliate links so I have some better conversion tracking data (not PPC traffic so no easy dynamic keyword insertion variables).
I want to do something like this:
User searches "keyword" in Google > User lands on mysite.com > search data is assigned to global variables that I can use in my affiliate link redirect script.
afflink.com/?id=123&keyword=[GA keyword variable]
Anybody know how I would go about doing that? I've seen other Non-GA tracking scripts do this but I can't figure it out here and it's driving me crazy!
Thanks,
DrewEDIT: Just figured it out after a lot of guess and testing... I'm not sure if the way I'm doing it is the fastest, most optimized way but it works.
Solution: I can pull the GA cookie and break it down to retrieve the keyword using PHP. For anyone searching for this in the future, here's how I did it:
$gacookie = $_COOKIE['__utmz'];
$keyword = substr(strstr($gacookie, 'utmctr='),7);?>
Then I can use the $keyword variable wherever I need it. I haven't actually tested this on a live site yet but everything is working fine as of right now.
If anyone has a better solution please feel free to answer.
-
I'm not sure if this is what you mean..
You want the keyword from a google search to show up on your afflink?
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Will i able to rank in google of i rephrase amazon product description?
Please guide me if I rephrase the information given on Amazon and write a unique article. Will my post rank in Google?
Affiliate Marketing | | Hmzashk512141 -
My affiliate links are being crawled by Google. Is this a bad thing? Also, should I add rel: nofollow to affiliate links?
Hi All, I have an issue on Google Search Console. It seems all my affiliate links are being crawled. Is this a bad thing? The reason I found out is that all but one link was flagged with a warming. It goes on to say that it was blocked by robots.txt. The strange thing is that I've not set any links to be blocked in robots.txt. Also, should affiliate links be nofollow? I'm asking because I was recently sent this article by Yoast on how to properly cloak my affiliate links without using a plugin. https://yoast.com/cloak-affiliate-links/ In the method, they apply the nofollow and noindex rules to the links. I'm just a little confused on how to go about affiliate links the SEO friendly way.
Affiliate Marketing | | nomad_blogger0 -
Display Networks Less Expensive Than the Google Display Network/GDN
Hi Everyone, Are there any display networks that are notably less expensive than Google's Display Network? By this, I mean less than $0.01 U.S. CPC's for real people and not bots. On the Google network, I've tried the trick of opening a sister account with a cheaper currency, but in the end, I wasn't able to get much lower than $0.01 U.S. per click after converting back to U.S. dollars. Thanks, Andy
Affiliate Marketing | | AndyRSB0 -
Does Canonical Tag passes link juice to the original URL?
We are using Canonical tags at almost all the pages of our eCommerce website. We have various sorting options like "High to Low", "Best Sellers", etc., due to this page URLs get change with some dynamic URL parameters. To avoid duplicity, we are using canonical tag on each page which point to the original url. Also, we are using IBM Coremetrics to track traffic and conversions, but to measure referral traffic in Coremetrics, we have to add tracking parameters in the URL. So, while link building we need to share URLs with Coremetrics tracking parameters in the URL, but the canonical of this page is pointing to the original URL. Suppose we have a Page that needs to be shared with Coremetrics tag: domain.com/category-name/?cm_mmc=Referral_-xyz--izUPF8VmRng--3 This Page has the canonical tag pointing to the original url: domain.com/category-name/ My question is if the URL: domain.com/category-name?cm_mmc=Referral_-xyz--izUPF8VmRng--3 got shared on other websites, will it pass link juice to the original URL: domain.com/category-name.
Affiliate Marketing | | Ramendra.Singh0 -
How to rank in google local listings with multiple entities?
I actually have a portal with multiple listings from different users. Every listing is a physical shop with a different address, but more than the half of them doesn't have a website. I was thinking on creating a local business for them and then add a link to my website in the section where google asks for your web address. Does anyone already made something similar? does google allows links to inner pages and from multiple domains? Do you have any other and better idea on how to show in local results if you're like an affiliate and not the direct owner of the shop? With google local listings crowding the serps it should be interesting to know how to fit in there.
Affiliate Marketing | | mememax0 -
How Google Shopping Relevance Determined?
After looking at Google Shopping results, I was wondering how the "Relevance" is determined. It would obviously be hugely beneficial to be ranked as one of the top 5 most relevant products, since that is the default sorting criteria. Originally, I thought it was a combination of Price and Seller Rating. But after examining a few examples, that doesn't seem to be the case. When doing a search for "Radian XTSL" - a car seat that our website features - JustKidsStore.com appears at/near the bottom of the Google Shopping list, despite having a competitive price and ranking well for that term organically (8-13). http://www.google.com/products/catalog?q=radian+xtsl&hl=en&safe=off&cid=15471698622239402479&os=sellers# Do you know what the ranking factors are? And if so, can you give a few pieces of advice for best practices? Thanks!
Affiliate Marketing | | BarrettAhern0 -
How long will it take for Google to forgive us?
Hi all, The last few weeks we started working on several affiliate websites. All was fine, the number of pages indexed in Google increased, rankings increased, visitors increased but; After two successful weeks Google noticed what we were doing and decided to crash our party. What we did; Create an affiliate website presenting shoes for ladies (15.000+ pages)
Affiliate Marketing | | footsteps
Create an affiliate website presenting brand shoes only (25.000+ pages)
Both sites were new domains and we linked them to each other. Biggest boo boo's we think we have made; We didn't put a no follow on the affiliatelinks We linked the websites to each other causing google to spot 25K new links to a new domain. Stuffed the index with 40K new pages out of nothing Didn't exclude the correct parameters in webmastertools so all items got indexed a multiple times. The above resulted in a drop of 95% of visitors and 3 weeks down the road we gained 10% from our low point. All boo boo's are corrected the last few day's and now we are wondering; How long will it take for Google to forgive us? And are we correct in concluding we messed up big time? Hope to hear your insight and let this story be a warning to others trying on this endeavour. Kind regards, Gerwin0 -
Passing link juice via aff links?
Hi All, I know there was a recent post on this subject but I'm wondering if someone could take a look at these links and tell me if there is any SEO value in them at all and if not, what would be a way to improve them that might not be too much trouble for the affiliate? This URL: http://www.premiermodelskin.com/the-products/blemish-treatment has a Purchase button that passes product data (price, quantity, etc) directly to the basket of the host site (the site we want SEO benefit to). Using a form method to this URL: <form method="GET" action="<strong>http://www.monushop.co.uk/products/premier/blemish-treatment.html</strong>"> Qty <select id="add" name="add"> <option value="1" selected="selected">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> 15ml £16.25 </form> My question is, does G see that form GET action as a followable link? If not what would be a better method? Any feedback much appreciated.
Affiliate Marketing | | lovealbatross
Cheers
J0