Find Jobs
Hire Freelancers

Adding Website optimizer javascript into PHP variable

$30-250 USD

Completed
Posted over 12 years ago

$30-250 USD

Paid on delivery
Hi, I like to include a javascript of Google website optimer into a PHP variable which i like to assign with smarty to a template. Here i send you the example code: $optimizer_test = <!-- Google Website Optimizer Control Script --> <script> function utmx_section(){}function utmx(){} (function(){var k='0231920119',d=document,l=[login to view URL],c=[login to view URL];function f(n){ if(c){var i=[login to view URL](n+'=');if(i>-1){var j=[login to view URL](';',i);return escape([login to view URL](i+n. length+1,j<0?[login to view URL]:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=[login to view URL]; [login to view URL]('<sc'+'ript src="'+ 'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.[login to view URL]' +'/[login to view URL]'+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime=' +new Date().valueOf()+(h?'&utmxhash='+escape([login to view URL](1)):'')+ '" type="text/javascript" charset="utf-8"></sc'+'ript>')})(); </script> <!-- End of Google Website Optimizer Control Script --> <!-- Google Website Optimizer Tracking Script --> <script type="text/javascript"> var _gaq = _gaq || []; [login to view URL](['gwo._setAccount', 'UA-3927776-2']); [login to view URL](['gwo._trackPageview', '/0231920119/test']); (function() { var ga = [login to view URL]('script'); [login to view URL] = 'text/javascript'; [login to view URL] = true; [login to view URL] = ('https:' == [login to view URL] ? 'https://ssl' : 'http://www') + '.[login to view URL]'; var s = [login to view URL]('script')[0]; [login to view URL](ga, s); })(); </script> <!-- End of Google Website Optimizer Tracking Script --> Then assign to smarty: $smarty->assign('optimizer_test', $optimizer_test); Then read it in the smarty template: {dynamic}{$optimizer_test}{/dynamic} I als want to do this with the conversion script of google website optimizer: <!-- Google Website Optimizer Tracking Script --> <script type="text/javascript"> var _gaq = _gaq || []; [login to view URL](['gwo._setAccount', 'UA-3927776-2']); [login to view URL](['gwo._trackPageview', '/0231920119/goal']); (function() { var ga = [login to view URL]('script'); [login to view URL] = 'text/javascript'; [login to view URL] = true; [login to view URL] = ('https:' == [login to view URL] ? 'https://ssl' : 'http://www') + '.[login to view URL]'; var s = [login to view URL]('script')[0]; [login to view URL](ga, s); })(); </script> <!-- End of Google Website Optimizer Tracking Script --> But when i use this code i get the follwing error: Parse error: syntax error, unexpected '<' Could you please help fixing this.
Project ID: 1156225

About the project

2 proposals
Remote project
Active 13 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Think can do this for you!
$30 USD in 0 day
5.0 (29 reviews)
4.6
4.6
2 freelancers are bidding on average $55 USD for this job
User Avatar
Please see PM, thanks.
$80 USD in 0 day
5.0 (70 reviews)
6.3
6.3

About the client

Flag of NETHERLANDS
Leusden, Netherlands
5.0
24
Payment method verified
Member since May 21, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.