You need to sign in to do that
Don't have an account?
Problem getting Google AdWords tracking on a new Lead VF page via Sites
Hi, I'm trying to get the SFGA code to work with a Lead creation on a website that uses a Visualforce page (Sites.) So far 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.
Does anyone know if this is possible and/or supported? I haven't been able to find any documentation or examples on it.
Thanks --
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>
Hi Tom - just posted this in the other thread as well - you missed a 2nd underscore in the __sfga() portion. It looks like you had only one underscore: _sfga()
Example from the other thread:
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
Hi Tom - just posted this in the other thread as well - you missed a 2nd underscore in the __sfga() portion. It looks like you had only one underscore: _sfga()
Example from the other thread:
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();
}
}
Hi John,
Thanks!
I wanted to wait to see results in our Production system before replying and we're still waiting for some administrative stuff on that... But anyhow, what you suggest seems to make sense (and was what I was hoping to hear)
The only other concern is that it will work with a vf page that uses the actionSupport/change tags for ajaxy stuff.
Thanks again. I'll update once I know it's working,
Tom