- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
04-27-2022 06:47 PM - edited 04-27-2022 08:03 PM
I'm trying to make an HTTP call via a Tealium function to return some additional data from hubspot on visitors and then make a second call to the collect endpoint to give that data back to tealium but I'm having timout issues during test I'm wondering if anyone has tried this and if you can help me out.
Processed event function is below. On their own the first call to hubspot takes around 375ms and the second to collect takes around 200ms and both complete successfully. I'm wondering if possibly there is a speed difference between test and prod. Tealium Functions have a fixed timeout of 1000ms so we should be well within acceptable limits of execution time.
import { auth, visitor, event } from "tealium"; const hubspotutk = event?.data?.firstparty_tealium_cookies?.hubspotutk; const url_1 = 'https://api.hubapi.com/contacts/v1/contact/utk/'+hubspotutk+'/profile?hapikey=apikey'; //console.log(ip_address); console.log("url_1: "+url_1); (async function() { try { // get email let hs_response = await fetch(url_1), hs_data = await hs_response.json(); //console.log(JSON.stringify(hs_data)); var hubspot_email= hs_data?.properties?.email?.value; console.log("hubspot_email: "+hubspot_email); // Send hubspot_email back into collect endpoint const url_2='https://collect.tealiumiq.com/event?tealium_account=account-name&tealium_profile=profile_name&tealium_datasource=ds_id&tealium_event=event_name&hubspot_email='+hubspot_email; console.log("url_2: "+url_2);
await fetch(encodeURI(url_2)); } catch(e) { console.error(e); return false; } })();
04-27-2022 07:45 PM
10-06-2022 10:58 AM
Copyright All Rights Reserved © 2008-2023