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?
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
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 -
Any good Pay Per Click Networks other than Google and Bing ???
Hi Guys Can anyone recommend any good Pay Per Click Networks other than Google and Bing where you can target customers via keywords and in the same manner as Google ?? Google is becoming way to expensive for us and so we need help looking at other pay per per click networks Thank you for any help Gareth
Affiliate Marketing | | GAZ090 -
In what ways would an affiliate site be okay with Google?
I know Google has slammed affiliate sites hard. But affiliate marketing can be a real business and had an idea for one, but I would like to know if ALL affiliate sites are looked at as evil in Google's eyes, or if it's just those with thin and duplicate content in the product descriptions. I know they want brands to come up ahead of affiliates of that brand, and that makes sense. If I sold Acme Widgets products, Acme Widgets itself should come up ahead of my site. But what if the site sold widgets in general, with the term widgets not a branded keyword? If all product descriptions are unique and well-written content, on a site that is high quality, would it still be downgraded by Google just because there are affilate links in it? I guess overall the question could be boiled down to, are affiliate sites hit because they have horrible content or because they have links to affiliate programs in them?
Affiliate Marketing | | bizzer0 -
Who are the top google adsense websites
hi, i remember reading about the top 100 google adsense websites but i cannot seem to find the list or the report and would like to know if anyone remembers seeing the article or the report and if so, can you please paste a link here so i can read it again.
Affiliate Marketing | | ClaireH-1848860 -
Google Analytics Tracking Pixels for Third-Party sites???
Hello, Does anyone know if it is possible to track an event on a third party site and have it post back to your Google Analytics account? For example, I am sending traffic to a partners site and I want to know if that traffic I am sending them will hit a specific point of conversion (a sale) and I'm wondering if it possible to place a tracking pixel on their thankyou.html page that gets recorded in my google analytics?
Affiliate Marketing | | shawn810 -
Duplicate versions of pages on my site are getting indexed by Google...I think...
Hello, Our site has a very high bounce rate, which in part is down to a slightly old fashioned design, and also because we are a retailer and I imagine many visitors are simply quickly comparing prices and then leaving. However, having had a look in Google Analytics, I think that there is another issue that is contributing to a very high bounce rate. When I look in Content > Top Content, and order the pages in order of Bounce Rate, high to low, there are hundreds of instances of pages with just one or two visits in the last month, and a 100% bounce rate. The links are the same as our home page or pages on our website, but with extra letters and numbers at the end of the url. We have an affiliate scheme, which provides our affiliates with unique codes for the products they want to link to, and my guess is that these urls are getting indexed. I've looked at a few other links, and they go to translated versions of a page from our website, generated by Google. Other urls seem to have been generated by search results from our own search on the website. What worries me is that there are lots and lots of versions of the same page, with slightly different urls. I am by no means an SEO expert - I work for a very small company and am basically learning as I go - but I know that duplicate content is bad news. If the pages were on our own site, we could use 301s to redirect, but what about translated versions, or urls generated by affiliate schemes, or search results? Many thanks, Sophy
Affiliate Marketing | | sophycolbert0 -
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