Pinterest reported better-than-expected earnings and revenue for the second quarter, though its forecast was online in line with estimates.