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
-
Google is mixing a product name with a technical term (both have same name)
Google is mixing a programming term name with a home product and ranking that programming website on top. And there is another 2 search results from the same website (DA - 56, PA - 55, Links - 71K, RD - 4500). Their positions are 1, 2 and 3. But the question/ answer section is showing question/ answer for both of the products, and there is local section, top stories, images, videos, Wikipedia, amazon, ad and an e-commerce site which is showing the home product. There are in total 7 results, and 1 ad. Google also showing description of both of the products on the right. 1,2,3 - Programming website, 4. Amazon, 5. Wikipedia, 6. Wikipedia, 7. E-commerce How difficult it could be to outrank the top result?
Affiliate Marketing | | Rafialam040 -
Why do my Google Analytics campaign URLs not show up in reports?
Hi guys, I'm puzzled because of my affiliate campaign URLs not showing up properly in my Google Analytics reports. I'll try to explain what I did and I hope some of you can provide advice on how to proceed from there on. What do I want to do?
Affiliate Marketing | | NHA_DistanceLearning
Actually, what I want to do is quite simple. I tagged a few URLs for Google Analytics to show up in my campaign reports. I used the URL builder to do so. Example: http://www.nhad.de?utm_source=affiliate&utm_medium=zanox&utm_content=banner&utm_campaign=105x139. Is that the entire URL?
Uhm, no. Because of the active de-duplication script on our website, I need to put some characters in front of it: **www.nhad.de/affiliate.aspx?NETWORK=ZANOX&NEXTURL=**http://www.nhad.de?utm_source=affiliate&utm_medium=zanox&utm_content=banner&utm_campaign=105x139. Yikes. Yes, I know. What do I see?
Basically, when I paste the above url and run it in (for example) Chrome, only this shows up in my browser: www.nhad.de/?utm_source=affiliate. In my Analytics reports, the campaign URL is not recognised, just the source in my traffic report. The medium is indicated with 'not set'. What am I doing wrong, and what can I do to make my campaigns appear in Analytics? Best, Bas0 -
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 -
Does Google look at Domain Registrar owner information when counting links into a site?
Question: If the domain registrar owner info is the same on two websites, will Google/other search engines discredit any linking between the two sites when calculating page rank? We have two company sites. One is our main ecommerce domain which we have been linking into from information domains in the past. We recently cut ties with the company that hosted them for us and wish to host them ourselves to preserve the inbound traffic. We are worried, however, that the traffic will be discredited now that we own both domains. Thanks for looking!
Affiliate Marketing | | tennisexpress0 -
How accurate is google analytics?
I have a new site that has just entered the SERPS so I'm tracking stats pretty carefully using google analytics. Yesterday according to my affiliate stats I had 10 unique visits with 2 sign ups for one of my products but google analytics only shows a total of 5 visitors yesterday on my site? ( A 20% conversion rate 2 out of 5 also seems ridiculously high). I'm guessing there were also a number of users that visited my site but didn't click through one of the affiliate links and just browsed the site so the visitor number could be higher? I'm not sure where this huge discrepancy comes from?
Affiliate Marketing | | SamCUK0 -
Does Any Know How Long It Takes Google Adsense to Approval App?
Does Any Know How Long It Takes Google Adsense to Approval App? I have been waiting almost a month.
Affiliate Marketing | | AppleCapitalGroup0 -
Google Panda & Effects On Affiliate Sites
Quick Question, We all have heard that outbound links for affiliate marketing will be filtered via Panda however how does this work when using the Google Affiliate Network URL's? Has anyone found different signals with using Google vs. Another Network?
Affiliate Marketing | | Ben-HPB0 -
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