You need to sign in to do that
Don't have an account?
JTec
Google Adwords Traking code in Sites
Hi,
We had implemented Google Adwords integration and this run fine if we use the sfga.js in a html page but when we have test this traking code in a Page to Force.com Sites this don't work. Our VisualForce Page have
The input <input type=hidden name="sfga" value="xxxxxxxxxxxxx" /> in the form and
This lines before the tag <body/>
<SCRIPT type="text/javascript" src="https://lct.salesforce.com/sfga.js"></SCRIPT>
<SCRIPT type="text/javascript">__sfga();</SCRIPT>
Thanks for the help.
We were able to get a test to work. Here's the VF & controller, though you probably don't need the controller. Note the value of the sfga hidden field needs to be your org ID.
VF
<apex:page controller="WebLeadController" sidebar="false" showHeader="false" cache="false">
<apex:define name="body">
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockSection >
<input type="hidden" name="sfga" value="00D30000000WnPC"/>
<apex:inputField value="{!Lead.LastName}"/>
<apex:inputField value="{!Lead.Email}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:commandButton value="Create this lead" action="{!save}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript" src="https://lct.salesforce.com/sfga.js"></script>
<script type="text/javascript">__sfga();</script>
</apex:define>
</apex:page>
Apex Controller:
public class WebLeadController { public Lead lead {get; private set;} public WebLeadController() { lead = new Lead(); } public PageReference save() { insert(lead); return (new ApexPages.StandardController(lead)).view(); } }
All Answers
Hey JTec,
I've noticed the same problem with our site, for some reason we're getting the following error
"Failed to load source for: https://lct.salesforce.com/sfga.js"
I'll let you know if I figure it out :)
I'm also very interested in how to get this going.
So far I've not found any implementation of this techinque out there... yet somewhere I heard SFDC specifically promoting the use of Sites with an iframe for getting Leads directly into your SFDC from a public website. That's fine and works very simply. However, I'm wondering how I get the Google tracking data onto to the new Lead (being create in the Visualforce controller code)
did you try this in your visualforce page?
<apex:includeScript value="https://lct.salesforce.com/sfga.js"/>
Thanks.
I gave it try but no go. I've queried the various SFGA objects through the IDE and no records are getting created... which means that the http://lct.salesforce.com/sfga.js isn't doing its thing I believe.
And of course the Lead Source stills show's up "Pending"
Here's the end of my VF code:
... many fields like the one below <apex:outputLabel value="Other Comments: " for="comments" /> <apex:inputTextArea id="inputComments" value="{!lead.Other_Comments__c}" /> <apex:commandButton action="{!saveLead}" value="Send" id="sendButton" /> </apex:panelGrid> </apex:outputPanel> <input type="hidden" name="oid" value="theSFDC_ORG" /> <input type="hidden" name="retURL" value="http://theurl.force.com.mysuccesspage" /> <input type="hidden" name="landing" id="landing" /> <input type="hidden" name="referrer" id="referrer" /> <input type="hidden" name="sfga" value="theSFDC_ORG" /> </apex:form> <apex:includeScript value="https://lct.salesforce.com/sfga.js"/> <script type="text/javascript">_sfga();</script> </body> </apex:page>
We were able to get a test to work. Here's the VF & controller, though you probably don't need the controller. Note the value of the sfga hidden field needs to be your org ID.
VF
<apex:page controller="WebLeadController" sidebar="false" showHeader="false" cache="false">
<apex:define name="body">
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockSection >
<input type="hidden" name="sfga" value="00D30000000WnPC"/>
<apex:inputField value="{!Lead.LastName}"/>
<apex:inputField value="{!Lead.Email}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:commandButton value="Create this lead" action="{!save}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript" src="https://lct.salesforce.com/sfga.js"></script>
<script type="text/javascript">__sfga();</script>
</apex:define>
</apex:page>
Apex Controller:
public class WebLeadController { public Lead lead {get; private set;} public WebLeadController() { lead = new Lead(); } public PageReference save() { insert(lead); return (new ApexPages.StandardController(lead)).view(); } }