URGENT | How to add custom code to a CTA?

Hi,

I would like to add a custom code in my CTA’s homepage in order to track event in LinkedIn campaign ads manager. Is anyone know how to do it ?

Many thanks for your help,
Aurélien

https://preview.webflow.com/preview/engage-salesapps?utm_medium=preview_link&utm_source=dashboard&utm_content=engage-salesapps&preview=c32a97ad1c12dbabb0be858cb7165f5b&workflow=preview

If you already have the custom code, you just need to add an Embed component in your CTA and paste the code inside the component.

1 Like

Hi @joejola

Thanks for your reply. I have checked but Embed component cannot be nested inside my CTA. I Could you explain how to do it, please ?

I would like to add it on the CTA above the fold.

@Aureldj95 - you can do this in basically two ways since you don’t have a thank you page and are submitting via AJAX

I like the second solution b/c it ensures that the conversion event is only fired when the form is successfully submitted, whereas the first solution only fires when the button is clicked. Either way it’s going to require a bit of custom code, although the onClick event is much simpler.

Basically when either event occurs you want to fire the LinkedIn event using the code provided, it should look something like this:

window.lintrk('track', { conversion_id: 2343434 });
1 Like

@Aureldj95 Do you already have the custom code? Can you share it? Then I can help you integrate.

@sam-g I don’t believe you can do onClick in Webflow. it’s a reserved attribute.

@joejola - you can get around it apparently: Add onClick attribute to any element with this JS snippet

1 Like

Thanks Sam. I am checking :slight_smile:

Could you tell me if I did right, please ? See attached a video recording the process.

@Aureldj95 - it looks like it is working:

Do you see conversions showing up in LinkedIn?

It’s say active on LinkedIn, but I am not able to see if the event goal is working properly until I launch a new campaign to see an action under “Tracked Campaign”

Capture d’écran 2022-05-12 à 19.14.58|690x38