APIs & Integrations

jonydov
Member

Trigger CTA Load on event

SOLVE

Is there a way to trigger the loading of a CTA?

I want to be able to manually (or if a another event is triggered), insert a CTA into a div.

 

Thanks!

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Trigger CTA Load on event

SOLVE

Hey @jonydov,

 

Are you referring to the HubSpot CTA? If so, I believe this is possible. Here's an example code that works just fine for me:

 

  <div id="testdiv" style="display:none;">
      
// I place my HubSpot CTA embed code here

      </div> 
<button id="show">Show hidden div</button>

      
      <script>
      
      $(function() {
  $('#show').click(function() {
    $('#testdiv').show();
    
  });

});
      </script>

The event triggered here is the button id - show. Once that's clicked, the #testdiv div will show. Hope this helps!

View solution in original post

0 Upvotes
4 Replies 4
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Trigger CTA Load on event

SOLVE

Hey @jonydov,

 

Are you referring to the HubSpot CTA? If so, I believe this is possible. Here's an example code that works just fine for me:

 

  <div id="testdiv" style="display:none;">
      
// I place my HubSpot CTA embed code here

      </div> 
<button id="show">Show hidden div</button>

      
      <script>
      
      $(function() {
  $('#show').click(function() {
    $('#testdiv').show();
    
  });

});
      </script>

The event triggered here is the button id - show. Once that's clicked, the #testdiv div will show. Hope this helps!

0 Upvotes
jonydov
Member

Trigger CTA Load on event

SOLVE

Thanks for the reply!

I was wondering if the button can be actually generated on event, rather than simply show/hide it.

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Trigger CTA Load on event

SOLVE

Hey @jonydov,

 

I tried to play around with it but I do not believe it is possible to generate the button within a function. The best way to go about doing this is placing the button within a div. 

0 Upvotes
jonydov
Member

Trigger CTA Load on event

SOLVE

Thank you!

0 Upvotes