473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Google Analytics E-Commerce code

Hello,

I've found this forum while searching for help to track my E-Commerce information from a thank you page.

I'm looking to add this piece of code on my page:

<form style="display:none;" name="utmform">
<textarea id="utmtrans">UTM:T|[order-id]|[affiliation]|
[total]|[tax]| [shipping]|[city]|[state]|[country] UTM:I|[order-id]|[sku/code]|[productname]|[category]|[price]|
[quantity] </textarea>
</form>

but as I don't have access to the ASP.net code, I need to generate it from a javascript code. I was thinking of a document.write but I heard/read that you can't have 2 in the same page, and I'm already using a document.write for the affiliate network tracking code.

Any recommendation?

Also, I did try to generate the code for the document.write for this textarea and I wasn't able to come up with the write sequence. I would appreciate if someone could help me. All the elements in the [] are variables so I guess I should be using + between them.

Here's what I came up with so far, but it fails...

document.write("textarea id=\"utmtrans\">UTM:T|"+MyOrderID+"|[affiliation]|
[total]|[tax]| [shipping]|[city]|[state]|[country]
</textarea>");

Where MyOrderID is a variable that contains the value that should be in the sequence.

Thanks
Jul 4 '07 #1
1 1772
pbmods
5,821 Expert 4TB
Heya Phoenix. Welcome to TSDN!

You can use document.write() as many times as you want, as long as you call it *before* your page is done loading (i.e., in a script tag somewhere before the closing </body> tag in your HTML).

While your page is loading, the document is open for writing, and document.write() works as expected. Once the page finishes loading, however, the browser 'closes' the document. In order to document.write() after the document has been closed, the document must be opened, which flushes anything that was already there.
Jul 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: FRITSCH Vincent | last post by:
Hi, i need help on a query. I've this table : create table t ( customer number(5), time date, status varchar2(1)
2
by: gen_tricomi | last post by:
THE IMPORTANCE OF MAKING THE GOOGLE INDEX DOWNLOADABLE I write here to make a request on behalf of all the programmers on earth who have been or are intending to use the Google web search API...
1
by: David Chang | last post by:
Hi, does any one know how google analytics (urchin.js) works? I always thought javascript cannot talk to multiple servers due to security constraints. But google analytics seems to be able to...
0
by: Ansuiya | last post by:
hii Can any 1 tell me which is fast ? AWstat or google analytics.Google Analytics takes too much time for processing but i dnt know about AWstat.Help please.. Thanx
20
by: tatata9999 | last post by:
The first generation of web site search engine hands-down is google. A majority of these web sites are static page -driven html pages. Now, I would think more and more web-based applications are...
14
victorduwon
by: victorduwon | last post by:
Hi guys and gals, I am using javascript to autologin to my google analytics account via a hyperlink. This is what the text looks like this <?xml version="1.0" encoding="utf-8"?>...
1
by: Joleen | last post by:
Are DHTML pages tracked via Google Analytics? http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.